aboutsummaryrefslogtreecommitdiff
path: root/doc/src/sgml/ref/alter_extension.sgml
blob: e9eb1aafbb6f3552a096f3c872bcf0d3f1ad7f3f (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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
<!--
doc/src/sgml/ref/alter_extension.sgml
PostgreSQL documentation
-->

<refentry id="SQL-ALTEREXTENSION">
 <refmeta>
  <refentrytitle>ALTER EXTENSION</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>ALTER EXTENSION</refname>
  <refpurpose>
   change the definition of an extension
  </refpurpose>
 </refnamediv>

 <indexterm zone="sql-alterextension">
  <primary>ALTER EXTENSION</primary>
 </indexterm>

 <refsynopsisdiv>
<synopsis>
ALTER EXTENSION <replaceable class="PARAMETER">extension_name</replaceable> SET SCHEMA <replaceable class="PARAMETER">new_schema</replaceable>
ALTER EXTENSION <replaceable class="PARAMETER">extension_name</replaceable> ADD <replaceable class="PARAMETER">member_object</replaceable>
ALTER EXTENSION <replaceable class="PARAMETER">extension_name</replaceable> DROP <replaceable class="PARAMETER">member_object</replaceable>

<phrase>where <replaceable class="PARAMETER">member_object</replaceable> is:</phrase>

  AGGREGATE <replaceable class="PARAMETER">agg_name</replaceable> (<replaceable class="PARAMETER">agg_type</replaceable> [, ...] ) |
  CAST (<replaceable>source_type</replaceable> AS <replaceable>target_type</replaceable>) |
  CONVERSION <replaceable class="PARAMETER">object_name</replaceable> |
  DOMAIN <replaceable class="PARAMETER">object_name</replaceable> |
  FOREIGN DATA WRAPPER <replaceable class="PARAMETER">object_name</replaceable> |
  FOREIGN TABLE <replaceable class="PARAMETER">object_name</replaceable> |
  FUNCTION <replaceable class="PARAMETER">function_name</replaceable> ( [ [ <replaceable class="parameter">argmode</replaceable> ] [ <replaceable class="parameter">argname</replaceable> ] <replaceable class="parameter">argtype</replaceable> [, ...] ] ) |
  OPERATOR <replaceable class="PARAMETER">operator_name</replaceable> (<replaceable class="PARAMETER">left_type</replaceable>, <replaceable class="PARAMETER">right_type</replaceable>) |
  OPERATOR CLASS <replaceable class="PARAMETER">object_name</replaceable> USING <replaceable class="parameter">index_method</replaceable> |
  OPERATOR FAMILY <replaceable class="PARAMETER">object_name</replaceable> USING <replaceable class="parameter">index_method</replaceable> |
  [ PROCEDURAL ] LANGUAGE <replaceable class="PARAMETER">object_name</replaceable> |
  SCHEMA <replaceable class="PARAMETER">object_name</replaceable> |
  SEQUENCE <replaceable class="PARAMETER">object_name</replaceable> |
  SERVER <replaceable class="PARAMETER">object_name</replaceable> |
  TABLE <replaceable class="PARAMETER">object_name</replaceable> |
  TEXT SEARCH CONFIGURATION <replaceable class="PARAMETER">object_name</replaceable> |
  TEXT SEARCH DICTIONARY <replaceable class="PARAMETER">object_name</replaceable> |
  TEXT SEARCH PARSER <replaceable class="PARAMETER">object_name</replaceable> |
  TEXT SEARCH TEMPLATE <replaceable class="PARAMETER">object_name</replaceable> |
  TYPE <replaceable class="PARAMETER">object_name</replaceable> |
  VIEW <replaceable class="PARAMETER">object_name</replaceable>
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>ALTER EXTENSION</command> changes the definition of an installed
   extension.  There are several subforms:

   <variablelist>
   <varlistentry>
    <term><literal>SET SCHEMA</literal></term>
    <listitem>
     <para>
      This form moves the extension's objects into another schema. The
      extension has to be <firstterm>relocatable</> for this command to
      succeed.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>ADD <replaceable class="PARAMETER">member_object</replaceable></literal></term>
    <listitem>
     <para>
      This form adds an existing object to the extension.  This is mainly
      useful in extension upgrade scripts.  The object will subsequently
      be treated as a member of the extension; notably, it can only be
      dropped by dropping the extension.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>DROP <replaceable class="PARAMETER">member_object</replaceable></literal></term>
    <listitem>
     <para>
      This form removes a member object from the extension.  This is mainly
      useful in extension upgrade scripts.  The object is not dropped, only
      disassociated from the extension.
     </para>
    </listitem>
   </varlistentry>
   </variablelist>

   See <xref linkend="extend-extensions"> for more information about these
   operations.
  </para>

  <para>
   Only superusers can execute <command>ALTER EXTENSION</command>.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <para>
   <variablelist>
    <varlistentry>
     <term><replaceable class="PARAMETER">extension_name</replaceable></term>
     <listitem>
      <para>
       The name of an installed extension.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable class="PARAMETER">new_schema</replaceable></term>
     <listitem>
      <para>
       The new schema for the extension.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable class="parameter">object_name</replaceable></term>
     <term><replaceable class="parameter">agg_name</replaceable></term>
     <term><replaceable class="parameter">function_name</replaceable></term>
     <term><replaceable class="parameter">operator_name</replaceable></term>
     <listitem>
      <para>
       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, sequences, text search objects,
       types, and views can be schema-qualified.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable class="parameter">agg_type</replaceable></term>
     <listitem>
      <para>
       An input data type on which the aggregate function operates.
       To reference a zero-argument aggregate function, write <literal>*</>
       in place of the list of input data types.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable>source_type</replaceable></term>
     <listitem>
      <para>
       The name of the source data type of the cast.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable>target_type</replaceable></term>
     <listitem>
      <para>
       The name of the target data type of the cast.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable class="parameter">argmode</replaceable></term>

     <listitem>
      <para>
       The mode of a function argument: <literal>IN</>, <literal>OUT</>,
       <literal>INOUT</>, or <literal>VARIADIC</>.
       If omitted, the default is <literal>IN</>.
       Note that <command>ALTER EXTENSION</command> does not actually pay
       any attention to <literal>OUT</> arguments, since only the input
       arguments are needed to determine the function's identity.
       So it is sufficient to list the <literal>IN</>, <literal>INOUT</>,
       and <literal>VARIADIC</> arguments.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable class="parameter">argname</replaceable></term>

     <listitem>
      <para>
       The name of a function argument.
       Note that <command>ALTER EXTENSION</command> does not actually pay
       any attention to argument names, since only the argument data
       types are needed to determine the function's identity.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable class="parameter">argtype</replaceable></term>

     <listitem>
      <para>
       The data type(s) of the function's arguments (optionally
       schema-qualified), if any.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><literal>PROCEDURAL</literal></term>

     <listitem>
      <para>
       This is a noise word.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   To change the schema of the extension <literal>hstore</literal>
   to <literal>utils</literal>:
<programlisting>
ALTER EXTENSION hstore SET SCHEMA utils;
</programlisting>
  </para>

  <para>
   To add an existing function to the <literal>hstore</literal> extension:
<programlisting>
ALTER EXTENSION hstore ADD FUNCTION populate_record(anyelement, hstore);
</programlisting>
  </para>
 </refsect1>

 <refsect1 id="SQL-ALTEREXTENSION-see-also">
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-createextension"></member>
   <member><xref linkend="sql-dropextension"></member>
  </simplelist>
 </refsect1>
</refentry>