2 doc/src/sgml/ref/alter_extension.sgml
3 PostgreSQL documentation
6 <refentry id="SQL-ALTEREXTENSION">
8 <refentrytitle>ALTER EXTENSION</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements</refmiscinfo>
14 <refname>ALTER EXTENSION</refname>
16 change the definition of an extension
20 <indexterm zone="sql-alterextension">
21 <primary>ALTER EXTENSION</primary>
26 ALTER EXTENSION <replaceable class="PARAMETER">extension_name</replaceable> UPDATE [ TO <replaceable class="PARAMETER">new_version</replaceable> ]
27 ALTER EXTENSION <replaceable class="PARAMETER">extension_name</replaceable> SET SCHEMA <replaceable class="PARAMETER">new_schema</replaceable>
28 ALTER EXTENSION <replaceable class="PARAMETER">extension_name</replaceable> ADD <replaceable class="PARAMETER">member_object</replaceable>
29 ALTER EXTENSION <replaceable class="PARAMETER">extension_name</replaceable> DROP <replaceable class="PARAMETER">member_object</replaceable>
31 <phrase>where <replaceable class="PARAMETER">member_object</replaceable> is:</phrase>
33 AGGREGATE <replaceable class="PARAMETER">agg_name</replaceable> (<replaceable class="PARAMETER">agg_type</replaceable> [, ...] ) |
34 CAST (<replaceable>source_type</replaceable> AS <replaceable>target_type</replaceable>) |
35 COLLATION <replaceable class="PARAMETER">object_name</replaceable> |
36 CONVERSION <replaceable class="PARAMETER">object_name</replaceable> |
37 DOMAIN <replaceable class="PARAMETER">object_name</replaceable> |
38 FOREIGN DATA WRAPPER <replaceable class="PARAMETER">object_name</replaceable> |
39 FOREIGN TABLE <replaceable class="PARAMETER">object_name</replaceable> |
40 FUNCTION <replaceable class="PARAMETER">function_name</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) |
41 OPERATOR <replaceable class="PARAMETER">operator_name</replaceable> (<replaceable class="PARAMETER">left_type</replaceable>, <replaceable class="PARAMETER">right_type</replaceable>) |
42 OPERATOR CLASS <replaceable class="PARAMETER">object_name</replaceable> USING <replaceable class="parameter">index_method</replaceable> |
43 OPERATOR FAMILY <replaceable class="PARAMETER">object_name</replaceable> USING <replaceable class="parameter">index_method</replaceable> |
44 [ PROCEDURAL ] LANGUAGE <replaceable class="PARAMETER">object_name</replaceable> |
45 SCHEMA <replaceable class="PARAMETER">object_name</replaceable> |
46 SEQUENCE <replaceable class="PARAMETER">object_name</replaceable> |
47 SERVER <replaceable class="PARAMETER">object_name</replaceable> |
48 TABLE <replaceable class="PARAMETER">object_name</replaceable> |
49 TEXT SEARCH CONFIGURATION <replaceable class="PARAMETER">object_name</replaceable> |
50 TEXT SEARCH DICTIONARY <replaceable class="PARAMETER">object_name</replaceable> |
51 TEXT SEARCH PARSER <replaceable class="PARAMETER">object_name</replaceable> |
52 TEXT SEARCH TEMPLATE <replaceable class="PARAMETER">object_name</replaceable> |
53 TYPE <replaceable class="PARAMETER">object_name</replaceable> |
54 VIEW <replaceable class="PARAMETER">object_name</replaceable>
59 <title>Description</title>
62 <command>ALTER EXTENSION</command> changes the definition of an installed
63 extension. There are several subforms:
67 <term><literal>UPDATE</literal></term>
70 This form updates the extension to a newer version. The extension
71 must supply a suitable update script (or series of scripts) that can
72 modify the currently-installed version into the requested version.
78 <term><literal>SET SCHEMA</literal></term>
81 This form moves the extension's objects into another schema. The
82 extension has to be <firstterm>relocatable</> for this command to
89 <term><literal>ADD <replaceable class="PARAMETER">member_object</replaceable></literal></term>
92 This form adds an existing object to the extension. This is mainly
93 useful in extension update scripts. The object will subsequently
94 be treated as a member of the extension; notably, it can only be
95 dropped by dropping the extension.
101 <term><literal>DROP <replaceable class="PARAMETER">member_object</replaceable></literal></term>
104 This form removes a member object from the extension. This is mainly
105 useful in extension update scripts. The object is not dropped, only
106 disassociated from the extension.
112 See <xref linkend="extend-extensions"> for more information about these
117 You must own the extension to use <command>ALTER EXTENSION</command>.
118 The <literal>ADD</>/<literal>DROP</> forms require ownership of the
119 added/dropped object as well.
124 <title>Parameters</title>
129 <term><replaceable class="PARAMETER">extension_name</replaceable></term>
132 The name of an installed extension.
138 <term><replaceable class="PARAMETER">new_version</replaceable></term>
141 The desired new version of the extension. This can be written as
142 either an identifier or a string literal. If not specified,
143 <command>ALTER EXTENSION UPDATE</> attempts to update to whatever is
144 shown as the default version in the extension's control file.
150 <term><replaceable class="PARAMETER">new_schema</replaceable></term>
153 The new schema for the extension.
159 <term><replaceable class="parameter">object_name</replaceable></term>
160 <term><replaceable class="parameter">agg_name</replaceable></term>
161 <term><replaceable class="parameter">function_name</replaceable></term>
162 <term><replaceable class="parameter">operator_name</replaceable></term>
165 The name of an object to be added to or removed from the extension.
167 aggregates, domains, foreign tables, functions, operators,
168 operator classes, operator families, sequences, text search objects,
169 types, and views can be schema-qualified.
175 <term><replaceable class="parameter">agg_type</replaceable></term>
178 An input data type on which the aggregate function operates.
179 To reference a zero-argument aggregate function, write <literal>*</>
180 in place of the list of input data types.
186 <term><replaceable>source_type</replaceable></term>
189 The name of the source data type of the cast.
195 <term><replaceable>target_type</replaceable></term>
198 The name of the target data type of the cast.
204 <term><replaceable class="parameter">argmode</replaceable></term>
208 The mode of a function argument: <literal>IN</>, <literal>OUT</>,
209 <literal>INOUT</>, or <literal>VARIADIC</>.
210 If omitted, the default is <literal>IN</>.
211 Note that <command>ALTER EXTENSION</command> does not actually pay
212 any attention to <literal>OUT</> arguments, since only the input
213 arguments are needed to determine the function's identity.
214 So it is sufficient to list the <literal>IN</>, <literal>INOUT</>,
215 and <literal>VARIADIC</> arguments.
221 <term><replaceable class="parameter">argname</replaceable></term>
225 The name of a function argument.
226 Note that <command>ALTER EXTENSION</command> does not actually pay
227 any attention to argument names, since only the argument data
228 types are needed to determine the function's identity.
234 <term><replaceable class="parameter">argtype</replaceable></term>
238 The data type(s) of the function's arguments (optionally
239 schema-qualified), if any.
245 <term><replaceable class="parameter">left_type</replaceable></term>
246 <term><replaceable class="parameter">right_type</replaceable></term>
249 The data type(s) of the operator's arguments (optionally
250 schema-qualified). Write <literal>NONE</> for the missing argument
251 of a prefix or postfix operator.
257 <term><literal>PROCEDURAL</literal></term>
261 This is a noise word.
270 <title>Examples</title>
273 To update the <literal>hstore</literal> extension to version 2.0:
275 ALTER EXTENSION hstore UPDATE TO '2.0';
280 To change the schema of the <literal>hstore</literal> extension
281 to <literal>utils</literal>:
283 ALTER EXTENSION hstore SET SCHEMA utils;
288 To add an existing function to the <literal>hstore</literal> extension:
290 ALTER EXTENSION hstore ADD FUNCTION populate_record(anyelement, hstore);
291 </programlisting></para>
295 <title>Compatibility</title>
298 <command>ALTER EXTENSION</command> is a <productname>PostgreSQL</>
303 <refsect1 id="SQL-ALTEREXTENSION-see-also">
304 <title>See Also</title>
306 <simplelist type="inline">
307 <member><xref linkend="sql-createextension"></member>
308 <member><xref linkend="sql-dropextension"></member>