2 doc/src/sgml/ref/alter_aggregate.sgml
3 PostgreSQL documentation
6 <refentry id="SQL-ALTERAGGREGATE">
8 <refentrytitle>ALTER AGGREGATE</refentrytitle>
9 <manvolnum>7</manvolnum>
10 <refmiscinfo>SQL - Language Statements</refmiscinfo>
14 <refname>ALTER AGGREGATE</refname>
15 <refpurpose>change the definition of an aggregate function</refpurpose>
18 <indexterm zone="sql-alteraggregate">
19 <primary>ALTER AGGREGATE</primary>
24 ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> [ , ... ] ) RENAME TO <replaceable>new_name</replaceable>
25 ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> [ , ... ] ) OWNER TO <replaceable>new_owner</replaceable>
26 ALTER AGGREGATE <replaceable>name</replaceable> ( <replaceable>type</replaceable> [ , ... ] ) SET SCHEMA <replaceable>new_schema</replaceable>
31 <title>Description</title>
34 <command>ALTER AGGREGATE</command> changes the definition of an
39 You must own the aggregate function to use <command>ALTER AGGREGATE</>.
40 To change the schema of an aggregate function, you must also have
41 <literal>CREATE</literal> privilege on the new schema.
42 To alter the owner, you must also be a direct or indirect member of the new
43 owning role, and that role must have <literal>CREATE</literal> privilege on
44 the aggregate function's schema. (These restrictions enforce that altering
45 the owner doesn't do anything you couldn't do by dropping and recreating
46 the aggregate function. However, a superuser can alter ownership of any
47 aggregate function anyway.)
52 <title>Parameters</title>
56 <term><replaceable class="parameter">name</replaceable></term>
59 The name (optionally schema-qualified) of an existing aggregate function.
65 <term><replaceable class="parameter">type</replaceable></term>
68 An input data type on which the aggregate function operates.
69 To reference a zero-argument aggregate function, write <literal>*</>
70 in place of the list of input data types.
76 <term><replaceable class="parameter">new_name</replaceable></term>
79 The new name of the aggregate function.
85 <term><replaceable class="parameter">new_owner</replaceable></term>
88 The new owner of the aggregate function.
94 <term><replaceable class="parameter">new_schema</replaceable></term>
97 The new schema for the aggregate function.
105 <title>Examples</title>
108 To rename the aggregate function <literal>myavg</literal> for type
109 <type>integer</type> to <literal>my_average</literal>:
111 ALTER AGGREGATE myavg(integer) RENAME TO my_average;
116 To change the owner of the aggregate function <literal>myavg</literal> for type
117 <type>integer</type> to <literal>joe</literal>:
119 ALTER AGGREGATE myavg(integer) OWNER TO joe;
124 To move the aggregate function <literal>myavg</literal> for type
125 <type>integer</type> into schema <literal>myschema</literal>:
127 ALTER AGGREGATE myavg(integer) SET SCHEMA myschema;
128 </programlisting></para>
132 <title>Compatibility</title>
135 There is no <command>ALTER AGGREGATE</command> statement in the SQL
141 <title>See Also</title>
143 <simplelist type="inline">
144 <member><xref linkend="sql-createaggregate"></member>
145 <member><xref linkend="sql-dropaggregate"></member>