# ALTER_OPERATOR - change the definition of an operator - man(7) - [phpMan]

_ALTER_ [_OPERATOR_(7)](https://www.chedong.com/phpMan.php/man/OPERATOR/7/markdown)                  PostgreSQL 16.14 Documentation                  _ALTER_ [_OPERATOR_(7)](https://www.chedong.com/phpMan.php/man/OPERATOR/7/markdown)

## NAME
       ALTER_OPERATOR - change the definition of an operator

## SYNOPSIS
       ALTER OPERATOR _name_ ( { _left_type_ | NONE } , _right_type_ )
           OWNER TO { _new_owner_ | CURRENT_ROLE | CURRENT_USER | SESSION_USER }

       ALTER OPERATOR _name_ ( { _left_type_ | NONE } , _right_type_ )
           SET SCHEMA _new_schema_

       ALTER OPERATOR _name_ ( { _left_type_ | NONE } , _right_type_ )
           SET ( {  RESTRICT = { _res_proc_ | NONE }
                  | JOIN = { _join_proc_ | NONE }
                } [, ... ] )

## DESCRIPTION
       **ALTER OPERATOR **changes the definition of an operator.

       You must own the operator to use **ALTER OPERATOR**. To alter the owner, you must be able to SET
       ROLE to the new owning role, and that role must have CREATE privilege on the operator's
       schema. (These restrictions enforce that altering the owner doesn't do anything you couldn't
       do by dropping and recreating the operator. However, a superuser can alter ownership of any
       operator anyway.)

## PARAMETERS
       _name_
           The name (optionally schema-qualified) of an existing operator.

       _left_type_
           The data type of the operator's left operand; write NONE if the operator has no left
           operand.

       _right_type_
           The data type of the operator's right operand.

       _new_owner_
           The new owner of the operator.

       _new_schema_
           The new schema for the operator.

       _res_proc_
           The restriction selectivity estimator function for this operator; write NONE to remove
           existing selectivity estimator.

       _join_proc_
           The join selectivity estimator function for this operator; write NONE to remove existing
           selectivity estimator.

## EXAMPLES
       Change the owner of a custom operator a @@ b for type text:

           ALTER OPERATOR @@ (text, text) OWNER TO joe;

       Change the restriction and join selectivity estimator functions of a custom operator a && b
       for type int[]:

           ALTER OPERATOR && (_int4, _int4) SET (RESTRICT = _int_contsel, JOIN = _int_contjoinsel);

## COMPATIBILITY
       There is no **ALTER OPERATOR **statement in the SQL standard.

## SEE ALSO
       CREATE OPERATOR ([**CREATE_OPERATOR**(7)](https://www.chedong.com/phpMan.php/man/CREATEOPERATOR/7/markdown)), DROP OPERATOR ([**DROP_OPERATOR**(7)](https://www.chedong.com/phpMan.php/man/DROPOPERATOR/7/markdown))

PostgreSQL 16.14                                2026                               _ALTER_ [_OPERATOR_(7)](https://www.chedong.com/phpMan.php/man/OPERATOR/7/markdown)
