]> begriffs open source - ai-pg/blob - full-docs/man7/ALTER_EXTENSION.7
Convert HTML docs to more streamlined TXT
[ai-pg] / full-docs / man7 / ALTER_EXTENSION.7
1 '\" t
2 .\"     Title: ALTER EXTENSION
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "ALTER EXTENSION" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 ALTER_EXTENSION \- change the definition of an extension
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 ALTER EXTENSION \fIname\fR UPDATE [ TO \fInew_version\fR ]
36 ALTER EXTENSION \fIname\fR SET SCHEMA \fInew_schema\fR
37 ALTER EXTENSION \fIname\fR ADD \fImember_object\fR
38 ALTER EXTENSION \fIname\fR DROP \fImember_object\fR
39
40 where \fImember_object\fR is:
41
42   ACCESS METHOD \fIobject_name\fR |
43   AGGREGATE \fIaggregate_name\fR ( \fIaggregate_signature\fR ) |
44   CAST (\fIsource_type\fR AS \fItarget_type\fR) |
45   COLLATION \fIobject_name\fR |
46   CONVERSION \fIobject_name\fR |
47   DOMAIN \fIobject_name\fR |
48   EVENT TRIGGER \fIobject_name\fR |
49   FOREIGN DATA WRAPPER \fIobject_name\fR |
50   FOREIGN TABLE \fIobject_name\fR |
51   FUNCTION \fIfunction_name\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] |
52   MATERIALIZED VIEW \fIobject_name\fR |
53   OPERATOR \fIoperator_name\fR (\fIleft_type\fR, \fIright_type\fR) |
54   OPERATOR CLASS \fIobject_name\fR USING \fIindex_method\fR |
55   OPERATOR FAMILY \fIobject_name\fR USING \fIindex_method\fR |
56   [ PROCEDURAL ] LANGUAGE \fIobject_name\fR |
57   PROCEDURE \fIprocedure_name\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] |
58   ROUTINE \fIroutine_name\fR [ ( [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [, \&.\&.\&.] ] ) ] |
59   SCHEMA \fIobject_name\fR |
60   SEQUENCE \fIobject_name\fR |
61   SERVER \fIobject_name\fR |
62   TABLE \fIobject_name\fR |
63   TEXT SEARCH CONFIGURATION \fIobject_name\fR |
64   TEXT SEARCH DICTIONARY \fIobject_name\fR |
65   TEXT SEARCH PARSER \fIobject_name\fR |
66   TEXT SEARCH TEMPLATE \fIobject_name\fR |
67   TRANSFORM FOR \fItype_name\fR LANGUAGE \fIlang_name\fR |
68   TYPE \fIobject_name\fR |
69   VIEW \fIobject_name\fR
70
71 and \fIaggregate_signature\fR is:
72
73 * |
74 [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [ , \&.\&.\&. ] |
75 [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [ , \&.\&.\&. ] ] ORDER BY [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [ , \&.\&.\&. ]
76 .fi
77 .SH "DESCRIPTION"
78 .PP
79 \fBALTER EXTENSION\fR
80 changes the definition of an installed extension\&. There are several subforms:
81 .PP
82 UPDATE
83 .RS 4
84 This form updates the extension to a newer version\&. The extension must supply a suitable update script (or series of scripts) that can modify the currently\-installed version into the requested version\&.
85 .RE
86 .PP
87 SET SCHEMA
88 .RS 4
89 This form moves the extension\*(Aqs objects into another schema\&. The extension has to be
90 relocatable
91 for this command to succeed\&.
92 .RE
93 .PP
94 ADD \fImember_object\fR
95 .RS 4
96 This form adds an existing object to the extension\&. This is mainly useful in extension update scripts\&. The object will subsequently be treated as a member of the extension; notably, it can only be dropped by dropping the extension\&.
97 .RE
98 .PP
99 DROP \fImember_object\fR
100 .RS 4
101 This form removes a member object from the extension\&. This is mainly useful in extension update scripts\&. The object is not dropped, only disassociated from the extension\&.
102 .RE
103 See
104 Section\ \&36.17
105 for more information about these operations\&.
106 .PP
107 You must own the extension to use
108 \fBALTER EXTENSION\fR\&. The
109 ADD/DROP
110 forms require ownership of the added/dropped object as well\&.
111 .SH "PARAMETERS"
112 .PP
113 .PP
114 \fIname\fR
115 .RS 4
116 The name of an installed extension\&.
117 .RE
118 .PP
119 \fInew_version\fR
120 .RS 4
121 The desired new version of the extension\&. This can be written as either an identifier or a string literal\&. If not specified,
122 \fBALTER EXTENSION UPDATE\fR
123 attempts to update to whatever is shown as the default version in the extension\*(Aqs control file\&.
124 .RE
125 .PP
126 \fInew_schema\fR
127 .RS 4
128 The new schema for the extension\&.
129 .RE
130 .PP
131 \fIobject_name\fR
132 .br
133 \fIaggregate_name\fR
134 .br
135 \fIfunction_name\fR
136 .br
137 \fIoperator_name\fR
138 .br
139 \fIprocedure_name\fR
140 .br
141 \fIroutine_name\fR
142 .RS 4
143 The name of an object to be added to or removed from the extension\&. Names of tables, aggregates, domains, foreign tables, functions, operators, operator classes, operator families, procedures, routines, sequences, text search objects, types, and views can be schema\-qualified\&.
144 .RE
145 .PP
146 \fIsource_type\fR
147 .RS 4
148 The name of the source data type of the cast\&.
149 .RE
150 .PP
151 \fItarget_type\fR
152 .RS 4
153 The name of the target data type of the cast\&.
154 .RE
155 .PP
156 \fIargmode\fR
157 .RS 4
158 The mode of a function, procedure, or aggregate argument:
159 IN,
160 OUT,
161 INOUT, or
162 VARIADIC\&. If omitted, the default is
163 IN\&. Note that
164 \fBALTER EXTENSION\fR
165 does not actually pay any attention to
166 OUT
167 arguments, since only the input arguments are needed to determine the function\*(Aqs identity\&. So it is sufficient to list the
168 IN,
169 INOUT, and
170 VARIADIC
171 arguments\&.
172 .RE
173 .PP
174 \fIargname\fR
175 .RS 4
176 The name of a function, procedure, or aggregate argument\&. Note that
177 \fBALTER EXTENSION\fR
178 does not actually pay any attention to argument names, since only the argument data types are needed to determine the function\*(Aqs identity\&.
179 .RE
180 .PP
181 \fIargtype\fR
182 .RS 4
183 The data type of a function, procedure, or aggregate argument\&.
184 .RE
185 .PP
186 \fIleft_type\fR
187 .br
188 \fIright_type\fR
189 .RS 4
190 The data type(s) of the operator\*(Aqs arguments (optionally schema\-qualified)\&. Write
191 NONE
192 for the missing argument of a prefix operator\&.
193 .RE
194 .PP
195 PROCEDURAL
196 .RS 4
197 This is a noise word\&.
198 .RE
199 .PP
200 \fItype_name\fR
201 .RS 4
202 The name of the data type of the transform\&.
203 .RE
204 .PP
205 \fIlang_name\fR
206 .RS 4
207 The name of the language of the transform\&.
208 .RE
209 .SH "EXAMPLES"
210 .PP
211 To update the
212 hstore
213 extension to version 2\&.0:
214 .sp
215 .if n \{\
216 .RS 4
217 .\}
218 .nf
219 ALTER EXTENSION hstore UPDATE TO \*(Aq2\&.0\*(Aq;
220 .fi
221 .if n \{\
222 .RE
223 .\}
224 .PP
225 To change the schema of the
226 hstore
227 extension to
228 utils:
229 .sp
230 .if n \{\
231 .RS 4
232 .\}
233 .nf
234 ALTER EXTENSION hstore SET SCHEMA utils;
235 .fi
236 .if n \{\
237 .RE
238 .\}
239 .PP
240 To add an existing function to the
241 hstore
242 extension:
243 .sp
244 .if n \{\
245 .RS 4
246 .\}
247 .nf
248 ALTER EXTENSION hstore ADD FUNCTION populate_record(anyelement, hstore);
249 .fi
250 .if n \{\
251 .RE
252 .\}
253 .SH "COMPATIBILITY"
254 .PP
255 \fBALTER EXTENSION\fR
256 is a
257 PostgreSQL
258 extension\&.
259 .SH "SEE ALSO"
260 CREATE EXTENSION (\fBCREATE_EXTENSION\fR(7)), DROP EXTENSION (\fBDROP_EXTENSION\fR(7))