summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/man7/ALTER_OPERATOR.7
blob: dc80e1477f303089927a5ed7d728befcdbfe8a55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
'\" t
.\"     Title: ALTER OPERATOR
.\"    Author: The PostgreSQL Global Development Group
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 2023
.\"    Manual: PostgreSQL 15.5 Documentation
.\"    Source: PostgreSQL 15.5
.\"  Language: English
.\"
.TH "ALTER OPERATOR" "7" "2023" "PostgreSQL 15.5" "PostgreSQL 15.5 Documentation"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ALTER_OPERATOR \- change the definition of an operator
.SH "SYNOPSIS"
.sp
.nf
ALTER OPERATOR \fIname\fR ( { \fIleft_type\fR | NONE } , \fIright_type\fR )
    OWNER TO { \fInew_owner\fR | CURRENT_ROLE | CURRENT_USER | SESSION_USER }

ALTER OPERATOR \fIname\fR ( { \fIleft_type\fR | NONE } , \fIright_type\fR )
    SET SCHEMA \fInew_schema\fR

ALTER OPERATOR \fIname\fR ( { \fIleft_type\fR | NONE } , \fIright_type\fR )
    SET ( {  RESTRICT = { \fIres_proc\fR | NONE }
           | JOIN = { \fIjoin_proc\fR | NONE }
         } [, \&.\&.\&. ] )
.fi
.SH "DESCRIPTION"
.PP
\fBALTER OPERATOR\fR
changes the definition of an operator\&.
.PP
You must own the operator to use
\fBALTER OPERATOR\fR\&. 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\*(Aqs schema\&. (These restrictions enforce that altering the owner doesn\*(Aqt do anything you couldn\*(Aqt do by dropping and recreating the operator\&. However, a superuser can alter ownership of any operator anyway\&.)
.SH "PARAMETERS"
.PP
\fIname\fR
.RS 4
The name (optionally schema\-qualified) of an existing operator\&.
.RE
.PP
\fIleft_type\fR
.RS 4
The data type of the operator\*(Aqs left operand; write
NONE
if the operator has no left operand\&.
.RE
.PP
\fIright_type\fR
.RS 4
The data type of the operator\*(Aqs right operand\&.
.RE
.PP
\fInew_owner\fR
.RS 4
The new owner of the operator\&.
.RE
.PP
\fInew_schema\fR
.RS 4
The new schema for the operator\&.
.RE
.PP
\fIres_proc\fR
.RS 4
The restriction selectivity estimator function for this operator; write NONE to remove existing selectivity estimator\&.
.RE
.PP
\fIjoin_proc\fR
.RS 4
The join selectivity estimator function for this operator; write NONE to remove existing selectivity estimator\&.
.RE
.SH "EXAMPLES"
.PP
Change the owner of a custom operator
a @@ b
for type
text:
.sp
.if n \{\
.RS 4
.\}
.nf
ALTER OPERATOR @@ (text, text) OWNER TO joe;
.fi
.if n \{\
.RE
.\}
.PP
Change the restriction and join selectivity estimator functions of a custom operator
a && b
for type
int[]:
.sp
.if n \{\
.RS 4
.\}
.nf
ALTER OPERATOR && (_int4, _int4) SET (RESTRICT = _int_contsel, JOIN = _int_contjoinsel);
.fi
.if n \{\
.RE
.\}
.SH "COMPATIBILITY"
.PP
There is no
\fBALTER OPERATOR\fR
statement in the SQL standard\&.
.SH "SEE ALSO"
CREATE OPERATOR (\fBCREATE_OPERATOR\fR(7)), DROP OPERATOR (\fBDROP_OPERATOR\fR(7))