blob: a63d838b0467a94ee866ac82d2a3499a30ebee41 [file]
---
title: ALTER OPERATOR
---
Changes the definition of an operator.
## <a id="synop"></a>Synopsis
```pre
ALTER OPERATOR <name> ( {<lefttype> | NONE} , {<righttype> | NONE} )
OWNER TO <newowner>
```
## <a id="desc"></a>Description
`ALTER OPERATOR` changes the definition of an operator. The only currently available functionality is to change the owner of the operator
You must own the operator to use `ALTER OPERATOR`. To alter the owner, you must also be a direct or indirect member of the new owning role, and that role must have `CREATE` privilege on the operators schema. (These restrictions enforce that altering the owner does not do anything you could not do by dropping and recreating the operator. However, a superuser can alter ownership of any operator anyway.)
## <a id="alteroperator__section4"></a>Parameters
<dt> \<name\> </dt>
<dd>The name (optionally schema-qualified) of an existing operator.</dd>
<dt> \<lefttype\> </dt>
<dd>The data type of the operator's left operand; write `NONE` if the operator has no left operand.</dd>
<dt> \<righttype\> </dt>
<dd>The data type of the operator's right operand; write `NONE` if the operator has no right operand.</dd>
<dt> \<newowner\> </dt>
<dd>The new owner of the operator.</dd>
## <a id="example"></a>Example
Change the owner of a custom operator `a @@ b` for type `text`:
```pre
ALTER OPERATOR @@ (text, text) OWNER TO joe;
```
## <a id="compat"></a>Compatibility
There is no `ALTER OPERATOR` statement in the SQL standard.
## <a id="see"></a>See Also
[CREATE OPERATOR](CREATE-OPERATOR.html), [DROP OPERATOR](DROP-OPERATOR.html)