| --- |
| title: ALTER OPERATOR |
| --- |
| |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| |
| 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 operator’s 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) |
| |
| |