2 .\" Title: ALTER EXTENSION
3 .\" Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
6 .\" Manual: PostgreSQL 18.0 Documentation
7 .\" Source: PostgreSQL 18.0
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 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
25 .\" disable justification (adjust text to left margin only)
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
31 ALTER_EXTENSION \- change the definition of an extension
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
40 where \fImember_object\fR is:
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
71 and \fIaggregate_signature\fR is:
74 [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [ , \&.\&.\&. ] |
75 [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [ , \&.\&.\&. ] ] ORDER BY [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [ , \&.\&.\&. ]
80 changes the definition of an installed extension\&. There are several subforms:
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\&.
89 This form moves the extension\*(Aqs objects into another schema\&. The extension has to be
91 for this command to succeed\&.
94 ADD \fImember_object\fR
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\&.
99 DROP \fImember_object\fR
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\&.
105 for more information about these operations\&.
107 You must own the extension to use
108 \fBALTER EXTENSION\fR\&. The
110 forms require ownership of the added/dropped object as well\&.
116 The name of an installed extension\&.
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\&.
128 The new schema for the extension\&.
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\&.
148 The name of the source data type of the cast\&.
153 The name of the target data type of the cast\&.
158 The mode of a function, procedure, or aggregate argument:
162 VARIADIC\&. If omitted, the default is
164 \fBALTER EXTENSION\fR
165 does not actually pay any attention to
167 arguments, since only the input arguments are needed to determine the function\*(Aqs identity\&. So it is sufficient to list the
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\&.
183 The data type of a function, procedure, or aggregate argument\&.
190 The data type(s) of the operator\*(Aqs arguments (optionally schema\-qualified)\&. Write
192 for the missing argument of a prefix operator\&.
197 This is a noise word\&.
202 The name of the data type of the transform\&.
207 The name of the language of the transform\&.
213 extension to version 2\&.0:
219 ALTER EXTENSION hstore UPDATE TO \*(Aq2\&.0\*(Aq;
225 To change the schema of the
234 ALTER EXTENSION hstore SET SCHEMA utils;
240 To add an existing function to the
248 ALTER EXTENSION hstore ADD FUNCTION populate_record(anyelement, hstore);
255 \fBALTER EXTENSION\fR
260 CREATE EXTENSION (\fBCREATE_EXTENSION\fR(7)), DROP EXTENSION (\fBDROP_EXTENSION\fR(7))