codekingpro/portable-devtools
115k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>ALTER EXTENSION</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="sql-altereventtrigger.html" title="ALTER EVENT TRIGGER" /><link rel="next" href="sql-alterforeigndatawrapper.html" title="ALTER FOREIGN DATA WRAPPER" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">ALTER EXTENSION</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="sql-altereventtrigger.html" title="ALTER EVENT TRIGGER">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><th width="60%" align="center">SQL Commands</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="sql-alterforeigndatawrapper.html" title="ALTER FOREIGN DATA WRAPPER">Next</a></td></tr></table><hr /></div><div class="refentry" id="SQL-ALTEREXTENSION"><div class="titlepage"></div><a id="id-1.9.3.11.1" class="indexterm"></a><div class="refnamediv"><h2><span class="refentrytitle">ALTER EXTENSION</span></h2><p>ALTER EXTENSION — 3 change the definition of an extension4 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">5ALTER EXTENSION <em class="replaceable"><code>name</code></em> UPDATE [ TO <em class="replaceable"><code>new_version</code></em> ]6ALTER EXTENSION <em class="replaceable"><code>name</code></em> SET SCHEMA <em class="replaceable"><code>new_schema</code></em>7ALTER EXTENSION <em class="replaceable"><code>name</code></em> ADD <em class="replaceable"><code>member_object</code></em>8ALTER EXTENSION <em class="replaceable"><code>name</code></em> DROP <em class="replaceable"><code>member_object</code></em>9 10<span class="phrase">where <em class="replaceable"><code>member_object</code></em> is:</span>11 12 ACCESS METHOD <em class="replaceable"><code>object_name</code></em> |13 AGGREGATE <em class="replaceable"><code>aggregate_name</code></em> ( <em class="replaceable"><code>aggregate_signature</code></em> ) |14 CAST (<em class="replaceable"><code>source_type</code></em> AS <em class="replaceable"><code>target_type</code></em>) |15 COLLATION <em class="replaceable"><code>object_name</code></em> |16 CONVERSION <em class="replaceable"><code>object_name</code></em> |17 DOMAIN <em class="replaceable"><code>object_name</code></em> |18 EVENT TRIGGER <em class="replaceable"><code>object_name</code></em> |19 FOREIGN DATA WRAPPER <em class="replaceable"><code>object_name</code></em> |20 FOREIGN TABLE <em class="replaceable"><code>object_name</code></em> |21 FUNCTION <em class="replaceable"><code>function_name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ] |22 MATERIALIZED VIEW <em class="replaceable"><code>object_name</code></em> |23 OPERATOR <em class="replaceable"><code>operator_name</code></em> (<em class="replaceable"><code>left_type</code></em>, <em class="replaceable"><code>right_type</code></em>) |24 OPERATOR CLASS <em class="replaceable"><code>object_name</code></em> USING <em class="replaceable"><code>index_method</code></em> |25 OPERATOR FAMILY <em class="replaceable"><code>object_name</code></em> USING <em class="replaceable"><code>index_method</code></em> |26 [ PROCEDURAL ] LANGUAGE <em class="replaceable"><code>object_name</code></em> |27 PROCEDURE <em class="replaceable"><code>procedure_name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ] |28 ROUTINE <em class="replaceable"><code>routine_name</code></em> [ ( [ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [, ...] ] ) ] |29 SCHEMA <em class="replaceable"><code>object_name</code></em> |30 SEQUENCE <em class="replaceable"><code>object_name</code></em> |31 SERVER <em class="replaceable"><code>object_name</code></em> |32 TABLE <em class="replaceable"><code>object_name</code></em> |33 TEXT SEARCH CONFIGURATION <em class="replaceable"><code>object_name</code></em> |34 TEXT SEARCH DICTIONARY <em class="replaceable"><code>object_name</code></em> |35 TEXT SEARCH PARSER <em class="replaceable"><code>object_name</code></em> |36 TEXT SEARCH TEMPLATE <em class="replaceable"><code>object_name</code></em> |37 TRANSFORM FOR <em class="replaceable"><code>type_name</code></em> LANGUAGE <em class="replaceable"><code>lang_name</code></em> |38 TYPE <em class="replaceable"><code>object_name</code></em> |39 VIEW <em class="replaceable"><code>object_name</code></em>40 41<span class="phrase">and <em class="replaceable"><code>aggregate_signature</code></em> is:</span>42 43* |44[ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [ , ... ] |45[ [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [ , ... ] ] ORDER BY [ <em class="replaceable"><code>argmode</code></em> ] [ <em class="replaceable"><code>argname</code></em> ] <em class="replaceable"><code>argtype</code></em> [ , ... ]46</pre></div><div class="refsect1" id="id-1.9.3.11.5"><h2>Description</h2><p>47 <code class="command">ALTER EXTENSION</code> changes the definition of an installed48 extension. There are several subforms:49 50 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><code class="literal">UPDATE</code></span></dt><dd><p>51 This form updates the extension to a newer version. The extension52 must supply a suitable update script (or series of scripts) that can53 modify the currently-installed version into the requested version.54 </p></dd><dt><span class="term"><code class="literal">SET SCHEMA</code></span></dt><dd><p>55 This form moves the extension's objects into another schema. The56 extension has to be <em class="firstterm">relocatable</em> for this command to57 succeed.58 </p></dd><dt><span class="term"><code class="literal">ADD <em class="replaceable"><code>member_object</code></em></code></span></dt><dd><p>59 This form adds an existing object to the extension. This is mainly60 useful in extension update scripts. The object will subsequently61 be treated as a member of the extension; notably, it can only be62 dropped by dropping the extension.63 </p></dd><dt><span class="term"><code class="literal">DROP <em class="replaceable"><code>member_object</code></em></code></span></dt><dd><p>64 This form removes a member object from the extension. This is mainly65 useful in extension update scripts. The object is not dropped, only66 disassociated from the extension.67 </p></dd></dl></div><p>68 69 See <a class="xref" href="extend-extensions.html" title="38.17. Packaging Related Objects into an Extension">Section 38.17</a> for more information about these70 operations.71 </p><p>72 You must own the extension to use <code class="command">ALTER EXTENSION</code>.73 The <code class="literal">ADD</code>/<code class="literal">DROP</code> forms require ownership of the74 added/dropped object as well.75 </p></div><div class="refsect1" id="id-1.9.3.11.6"><h2>Parameters</h2><p>76 </p><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="replaceable"><code>name</code></em></span></dt><dd><p>77 The name of an installed extension.78 </p></dd><dt><span class="term"><em class="replaceable"><code>new_version</code></em></span></dt><dd><p>79 The desired new version of the extension. This can be written as80 either an identifier or a string literal. If not specified,81 <code class="command">ALTER EXTENSION UPDATE</code> attempts to update to whatever is82 shown as the default version in the extension's control file.83 </p></dd><dt><span class="term"><em class="replaceable"><code>new_schema</code></em></span></dt><dd><p>84 The new schema for the extension.85 </p></dd><dt><span class="term"><em class="replaceable"><code>object_name</code></em><br /></span><span class="term"><em class="replaceable"><code>aggregate_name</code></em><br /></span><span class="term"><em class="replaceable"><code>function_name</code></em><br /></span><span class="term"><em class="replaceable"><code>operator_name</code></em><br /></span><span class="term"><em class="replaceable"><code>procedure_name</code></em><br /></span><span class="term"><em class="replaceable"><code>routine_name</code></em></span></dt><dd><p>86 The name of an object to be added to or removed from the extension.87 Names of tables,88 aggregates, domains, foreign tables, functions, operators,89 operator classes, operator families, procedures, routines, sequences, text search objects,90 types, and views can be schema-qualified.91 </p></dd><dt><span class="term"><em class="replaceable"><code>source_type</code></em></span></dt><dd><p>92 The name of the source data type of the cast.93 </p></dd><dt><span class="term"><em class="replaceable"><code>target_type</code></em></span></dt><dd><p>94 The name of the target data type of the cast.95 </p></dd><dt><span class="term"><em class="replaceable"><code>argmode</code></em></span></dt><dd><p>96 The mode of a function, procedure, or aggregate97 argument: <code class="literal">IN</code>, <code class="literal">OUT</code>,98 <code class="literal">INOUT</code>, or <code class="literal">VARIADIC</code>.99 If omitted, the default is <code class="literal">IN</code>.100 Note that <code class="command">ALTER EXTENSION</code> does not actually pay101 any attention to <code class="literal">OUT</code> arguments, since only the input102 arguments are needed to determine the function's identity.103 So it is sufficient to list the <code class="literal">IN</code>, <code class="literal">INOUT</code>,104 and <code class="literal">VARIADIC</code> arguments.105 </p></dd><dt><span class="term"><em class="replaceable"><code>argname</code></em></span></dt><dd><p>106 The name of a function, procedure, or aggregate argument.107 Note that <code class="command">ALTER EXTENSION</code> does not actually pay108 any attention to argument names, since only the argument data109 types are needed to determine the function's identity.110 </p></dd><dt><span class="term"><em class="replaceable"><code>argtype</code></em></span></dt><dd><p>111 The data type of a function, procedure, or aggregate argument.112 </p></dd><dt><span class="term"><em class="replaceable"><code>left_type</code></em><br /></span><span class="term"><em class="replaceable"><code>right_type</code></em></span></dt><dd><p>113 The data type(s) of the operator's arguments (optionally114 schema-qualified). Write <code class="literal">NONE</code> for the missing argument115 of a prefix operator.116 </p></dd><dt><span class="term"><code class="literal">PROCEDURAL</code></span></dt><dd><p>117 This is a noise word.118 </p></dd><dt><span class="term"><em class="replaceable"><code>type_name</code></em></span></dt><dd><p>119 The name of the data type of the transform.120 </p></dd><dt><span class="term"><em class="replaceable"><code>lang_name</code></em></span></dt><dd><p>121 The name of the language of the transform.122 </p></dd></dl></div><p>123 </p></div><div class="refsect1" id="id-1.9.3.11.7"><h2>Examples</h2><p>124 To update the <code class="literal">hstore</code> extension to version 2.0:125</p><pre class="programlisting">126ALTER EXTENSION hstore UPDATE TO '2.0';127</pre><p>128 </p><p>129 To change the schema of the <code class="literal">hstore</code> extension130 to <code class="literal">utils</code>:131</p><pre class="programlisting">132ALTER EXTENSION hstore SET SCHEMA utils;133</pre><p>134 </p><p>135 To add an existing function to the <code class="literal">hstore</code> extension:136</p><pre class="programlisting">137ALTER EXTENSION hstore ADD FUNCTION populate_record(anyelement, hstore);138</pre></div><div class="refsect1" id="id-1.9.3.11.8"><h2>Compatibility</h2><p>139 <code class="command">ALTER EXTENSION</code> is a <span class="productname">PostgreSQL</span>140 extension.141 </p></div><div class="refsect1" id="SQL-ALTEREXTENSION-SEE-ALSO"><h2>See Also</h2><span class="simplelist"><a class="xref" href="sql-createextension.html" title="CREATE EXTENSION"><span class="refentrytitle">CREATE EXTENSION</span></a>, <a class="xref" href="sql-dropextension.html" title="DROP EXTENSION"><span class="refentrytitle">DROP EXTENSION</span></a></span></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sql-altereventtrigger.html" title="ALTER EVENT TRIGGER">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="sql-commands.html" title="SQL Commands">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="sql-alterforeigndatawrapper.html" title="ALTER FOREIGN DATA WRAPPER">Next</a></td></tr><tr><td width="40%" align="left" valign="top">ALTER EVENT TRIGGER </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> ALTER FOREIGN DATA WRAPPER</td></tr></table></div></body></html>