1ALTER OPERATOR(7)        PostgreSQL 15.4 Documentation       ALTER OPERATOR(7)
2
3
4

NAME

6       ALTER_OPERATOR - change the definition of an operator
7

SYNOPSIS

9       ALTER OPERATOR name ( { left_type | NONE } , right_type )
10           OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
11
12       ALTER OPERATOR name ( { left_type | NONE } , right_type )
13           SET SCHEMA new_schema
14
15       ALTER OPERATOR name ( { left_type | NONE } , right_type )
16           SET ( {  RESTRICT = { res_proc | NONE }
17                  | JOIN = { join_proc | NONE }
18                } [, ... ] )
19

DESCRIPTION

21       ALTER OPERATOR changes the definition of an operator.
22
23       You must own the operator to use ALTER OPERATOR. To alter the owner,
24       you must also be a direct or indirect member of the new owning role,
25       and that role must have CREATE privilege on the operator's schema.
26       (These restrictions enforce that altering the owner doesn't do anything
27       you couldn't do by dropping and recreating the operator. However, a
28       superuser can alter ownership of any operator anyway.)
29

PARAMETERS

31       name
32           The name (optionally schema-qualified) of an existing operator.
33
34       left_type
35           The data type of the operator's left operand; write NONE if the
36           operator has no left operand.
37
38       right_type
39           The data type of the operator's right operand.
40
41       new_owner
42           The new owner of the operator.
43
44       new_schema
45           The new schema for the operator.
46
47       res_proc
48           The restriction selectivity estimator function for this operator;
49           write NONE to remove existing selectivity estimator.
50
51       join_proc
52           The join selectivity estimator function for this operator; write
53           NONE to remove existing selectivity estimator.
54

EXAMPLES

56       Change the owner of a custom operator a @@ b for type text:
57
58           ALTER OPERATOR @@ (text, text) OWNER TO joe;
59
60       Change the restriction and join selectivity estimator functions of a
61       custom operator a && b for type int[]:
62
63           ALTER OPERATOR && (_int4, _int4) SET (RESTRICT = _int_contsel, JOIN = _int_contjoinsel);
64

COMPATIBILITY

66       There is no ALTER OPERATOR statement in the SQL standard.
67

SEE ALSO

69       CREATE OPERATOR (CREATE_OPERATOR(7)), DROP OPERATOR (DROP_OPERATOR(7))
70
71
72
73PostgreSQL 15.4                      2023                    ALTER OPERATOR(7)
Impressum