1ALTER EXTENSION(7)       PostgreSQL 16.1 Documentation      ALTER EXTENSION(7)
2
3
4

NAME

6       ALTER_EXTENSION - change the definition of an extension
7

SYNOPSIS

9       ALTER EXTENSION name UPDATE [ TO new_version ]
10       ALTER EXTENSION name SET SCHEMA new_schema
11       ALTER EXTENSION name ADD member_object
12       ALTER EXTENSION name DROP member_object
13
14       where member_object is:
15
16         ACCESS METHOD object_name |
17         AGGREGATE aggregate_name ( aggregate_signature ) |
18         CAST (source_type AS target_type) |
19         COLLATION object_name |
20         CONVERSION object_name |
21         DOMAIN object_name |
22         EVENT TRIGGER object_name |
23         FOREIGN DATA WRAPPER object_name |
24         FOREIGN TABLE object_name |
25         FUNCTION function_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
26         MATERIALIZED VIEW object_name |
27         OPERATOR operator_name (left_type, right_type) |
28         OPERATOR CLASS object_name USING index_method |
29         OPERATOR FAMILY object_name USING index_method |
30         [ PROCEDURAL ] LANGUAGE object_name |
31         PROCEDURE procedure_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
32         ROUTINE routine_name [ ( [ [ argmode ] [ argname ] argtype [, ...] ] ) ] |
33         SCHEMA object_name |
34         SEQUENCE object_name |
35         SERVER object_name |
36         TABLE object_name |
37         TEXT SEARCH CONFIGURATION object_name |
38         TEXT SEARCH DICTIONARY object_name |
39         TEXT SEARCH PARSER object_name |
40         TEXT SEARCH TEMPLATE object_name |
41         TRANSFORM FOR type_name LANGUAGE lang_name |
42         TYPE object_name |
43         VIEW object_name
44
45       and aggregate_signature is:
46
47       * |
48       [ argmode ] [ argname ] argtype [ , ... ] |
49       [ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]
50

DESCRIPTION

52       ALTER EXTENSION changes the definition of an installed extension. There
53       are several subforms:
54
55       UPDATE
56           This form updates the extension to a newer version. The extension
57           must supply a suitable update script (or series of scripts) that
58           can modify the currently-installed version into the requested
59           version.
60
61       SET SCHEMA
62           This form moves the extension's objects into another schema. The
63           extension has to be relocatable for this command to succeed.
64
65       ADD member_object
66           This form adds an existing object to the extension. This is mainly
67           useful in extension update scripts. The object will subsequently be
68           treated as a member of the extension; notably, it can only be
69           dropped by dropping the extension.
70
71       DROP member_object
72           This form removes a member object from the extension. This is
73           mainly useful in extension update scripts. The object is not
74           dropped, only disassociated from the extension.
75       See Section 38.17 for more information about these operations.
76
77       You must own the extension to use ALTER EXTENSION. The ADD/DROP forms
78       require ownership of the added/dropped object as well.
79

PARAMETERS

81       name
82           The name of an installed extension.
83
84       new_version
85           The desired new version of the extension. This can be written as
86           either an identifier or a string literal. If not specified, ALTER
87           EXTENSION UPDATE attempts to update to whatever is shown as the
88           default version in the extension's control file.
89
90       new_schema
91           The new schema for the extension.
92
93       object_name
94       aggregate_name
95       function_name
96       operator_name
97       procedure_name
98       routine_name
99           The name of an object to be added to or removed from the extension.
100           Names of tables, aggregates, domains, foreign tables, functions,
101           operators, operator classes, operator families, procedures,
102           routines, sequences, text search objects, types, and views can be
103           schema-qualified.
104
105       source_type
106           The name of the source data type of the cast.
107
108       target_type
109           The name of the target data type of the cast.
110
111       argmode
112           The mode of a function, procedure, or aggregate argument: IN, OUT,
113           INOUT, or VARIADIC. If omitted, the default is IN. Note that ALTER
114           EXTENSION does not actually pay any attention to OUT arguments,
115           since only the input arguments are needed to determine the
116           function's identity. So it is sufficient to list the IN, INOUT, and
117           VARIADIC arguments.
118
119       argname
120           The name of a function, procedure, or aggregate argument. Note that
121           ALTER EXTENSION does not actually pay any attention to argument
122           names, since only the argument data types are needed to determine
123           the function's identity.
124
125       argtype
126           The data type of a function, procedure, or aggregate argument.
127
128       left_type
129       right_type
130           The data type(s) of the operator's arguments (optionally
131           schema-qualified). Write NONE for the missing argument of a prefix
132           operator.
133
134       PROCEDURAL
135           This is a noise word.
136
137       type_name
138           The name of the data type of the transform.
139
140       lang_name
141           The name of the language of the transform.
142

EXAMPLES

144       To update the hstore extension to version 2.0:
145
146           ALTER EXTENSION hstore UPDATE TO '2.0';
147
148       To change the schema of the hstore extension to utils:
149
150           ALTER EXTENSION hstore SET SCHEMA utils;
151
152       To add an existing function to the hstore extension:
153
154           ALTER EXTENSION hstore ADD FUNCTION populate_record(anyelement, hstore);
155

COMPATIBILITY

157       ALTER EXTENSION is a PostgreSQL extension.
158

SEE ALSO

160       CREATE EXTENSION (CREATE_EXTENSION(7)), DROP EXTENSION
161       (DROP_EXTENSION(7))
162
163
164
165PostgreSQL 16.1                      2023                   ALTER EXTENSION(7)
Impressum