| 1 |
<!-- |
| 2 |
doc/src/sgml/ref/drop_aggregate.sgml |
| 3 |
PostgreSQL documentation |
| 4 |
--> |
| 5 |
|
| 6 |
<refentry id="sql-dropaggregate"> |
| 7 |
<indexterm zone="sql-dropaggregate"> |
| 8 |
<primary>DROP AGGREGATE</primary> |
| 9 |
</indexterm> |
| 10 |
|
| 11 |
<refmeta> |
| 12 |
<refentrytitle>DROP AGGREGATE</refentrytitle> |
| 13 |
<manvolnum>7</manvolnum> |
| 14 |
<refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 15 |
</refmeta> |
| 16 |
|
| 17 |
<refnamediv> |
| 18 |
<refname>DROP AGGREGATE</refname> |
| 19 |
<refpurpose>remove an aggregate function</refpurpose> |
| 20 |
</refnamediv> |
| 21 |
|
| 22 |
<refsynopsisdiv> |
| 23 |
<synopsis> |
| 24 |
DROP AGGREGATE [ IF EXISTS ] <replaceable>name</replaceable> ( <replaceable>aggregate_signature</replaceable> ) [, ...] [ CASCADE | RESTRICT ] |
| 25 |
|
| 26 |
<phrase>where <replaceable>aggregate_signature</replaceable> is:</phrase> |
| 27 |
|
| 28 |
* | |
| 29 |
[ <replaceable>argmode</replaceable> ] [ <replaceable>argname</replaceable> ] <replaceable>argtype</replaceable> [ , ... ] | |
| 30 |
[ [ <replaceable>argmode</replaceable> ] [ <replaceable>argname</replaceable> ] <replaceable>argtype</replaceable> [ , ... ] ] ORDER BY [ <replaceable>argmode</replaceable> ] [ <replaceable>argname</replaceable> ] <replaceable>argtype</replaceable> [ , ... ] |
| 31 |
</synopsis> |
| 32 |
</refsynopsisdiv> |
| 33 |
|
| 34 |
<refsect1> |
| 35 |
<title>Description</title> |
| 36 |
|
| 37 |
<para> |
| 38 |
<command>DROP AGGREGATE</command> removes an existing |
| 39 |
aggregate function. To execute this command the current |
| 40 |
user must be the owner of the aggregate function. |
| 41 |
</para> |
| 42 |
</refsect1> |
| 43 |
|
| 44 |
<refsect1> |
| 45 |
<title>Parameters</title> |
| 46 |
|
| 47 |
<variablelist> |
| 48 |
|
| 49 |
<varlistentry> |
| 50 |
<term><literal>IF EXISTS</literal></term> |
| 51 |
<listitem> |
| 52 |
<para> |
| 53 |
Do not throw an error if the aggregate does not exist. A notice is issued |
| 54 |
in this case. |
| 55 |
</para> |
| 56 |
</listitem> |
| 57 |
</varlistentry> |
| 58 |
|
| 59 |
<varlistentry> |
| 60 |
<term><replaceable class="parameter">name</replaceable></term> |
| 61 |
<listitem> |
| 62 |
<para> |
| 63 |
The name (optionally schema-qualified) of an existing aggregate function. |
| 64 |
</para> |
| 65 |
</listitem> |
| 66 |
</varlistentry> |
| 67 |
|
| 68 |
<varlistentry> |
| 69 |
<term><replaceable class="parameter">argmode</replaceable></term> |
| 70 |
|
| 71 |
<listitem> |
| 72 |
<para> |
| 73 |
The mode of an argument: <literal>IN</literal> or <literal>VARIADIC</literal>. |
| 74 |
If omitted, the default is <literal>IN</literal>. |
| 75 |
</para> |
| 76 |
</listitem> |
| 77 |
</varlistentry> |
| 78 |
|
| 79 |
<varlistentry> |
| 80 |
<term><replaceable class="parameter">argname</replaceable></term> |
| 81 |
|
| 82 |
<listitem> |
| 83 |
<para> |
| 84 |
The name of an argument. |
| 85 |
Note that <command>DROP AGGREGATE</command> does not actually pay |
| 86 |
any attention to argument names, since only the argument data |
| 87 |
types are needed to determine the aggregate function's identity. |
| 88 |
</para> |
| 89 |
</listitem> |
| 90 |
</varlistentry> |
| 91 |
|
| 92 |
<varlistentry> |
| 93 |
<term><replaceable class="parameter">argtype</replaceable></term> |
| 94 |
<listitem> |
| 95 |
<para> |
| 96 |
An input data type on which the aggregate function operates. |
| 97 |
To reference a zero-argument aggregate function, write <literal>*</literal> |
| 98 |
in place of the list of argument specifications. |
| 99 |
To reference an ordered-set aggregate function, write |
| 100 |
<literal>ORDER BY</literal> between the direct and aggregated argument |
| 101 |
specifications. |
| 102 |
</para> |
| 103 |
</listitem> |
| 104 |
</varlistentry> |
| 105 |
|
| 106 |
<varlistentry> |
| 107 |
<term><literal>CASCADE</literal></term> |
| 108 |
<listitem> |
| 109 |
<para> |
| 110 |
Automatically drop objects that depend on the aggregate function |
| 111 |
(such as views using it), |
| 112 |
and in turn all objects that depend on those objects |
| 113 |
(see <xref linkend="ddl-depend"/>). |
| 114 |
</para> |
| 115 |
</listitem> |
| 116 |
</varlistentry> |
| 117 |
|
| 118 |
<varlistentry> |
| 119 |
<term><literal>RESTRICT</literal></term> |
| 120 |
<listitem> |
| 121 |
<para> |
| 122 |
Refuse to drop the aggregate function if any objects depend on |
| 123 |
it. This is the default. |
| 124 |
</para> |
| 125 |
</listitem> |
| 126 |
</varlistentry> |
| 127 |
</variablelist> |
| 128 |
</refsect1> |
| 129 |
|
| 130 |
<refsect1> |
| 131 |
<title>Notes</title> |
| 132 |
|
| 133 |
<para> |
| 134 |
Alternative syntaxes for referencing ordered-set aggregates |
| 135 |
are described under <xref linkend="sql-alteraggregate"/>. |
| 136 |
</para> |
| 137 |
</refsect1> |
| 138 |
|
| 139 |
<refsect1> |
| 140 |
<title>Examples</title> |
| 141 |
|
| 142 |
<para> |
| 143 |
To remove the aggregate function <literal>myavg</literal> for type |
| 144 |
<type>integer</type>: |
| 145 |
<programlisting> |
| 146 |
DROP AGGREGATE myavg(integer); |
| 147 |
</programlisting> |
| 148 |
</para> |
| 149 |
|
| 150 |
<para> |
| 151 |
To remove the hypothetical-set aggregate function <literal>myrank</literal>, |
| 152 |
which takes an arbitrary list of ordering columns and a matching list |
| 153 |
of direct arguments: |
| 154 |
<programlisting> |
| 155 |
DROP AGGREGATE myrank(VARIADIC "any" ORDER BY VARIADIC "any"); |
| 156 |
</programlisting> |
| 157 |
</para> |
| 158 |
|
| 159 |
<para> |
| 160 |
To remove multiple aggregate functions in one command: |
| 161 |
<programlisting> |
| 162 |
DROP AGGREGATE myavg(integer), myavg(bigint); |
| 163 |
</programlisting></para> |
| 164 |
</refsect1> |
| 165 |
|
| 166 |
<refsect1> |
| 167 |
<title>Compatibility</title> |
| 168 |
|
| 169 |
<para> |
| 170 |
There is no <command>DROP AGGREGATE</command> statement in the SQL |
| 171 |
standard. |
| 172 |
</para> |
| 173 |
</refsect1> |
| 174 |
|
| 175 |
<refsect1> |
| 176 |
<title>See Also</title> |
| 177 |
|
| 178 |
<simplelist type="inline"> |
| 179 |
<member><xref linkend="sql-alteraggregate"/></member> |
| 180 |
<member><xref linkend="sql-createaggregate"/></member> |
| 181 |
</simplelist> |
| 182 |
</refsect1> |
| 183 |
|
| 184 |
</refentry> |