]> begriffs open source - ai-pg/blob - full-docs/src/sgml/man7/DROP_AGGREGATE.7
WIP: toc builder
[ai-pg] / full-docs / src / sgml / man7 / DROP_AGGREGATE.7
1 '\" t
2 .\"     Title: DROP AGGREGATE
3 .\"    Author: The PostgreSQL Global Development Group
4 .\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
5 .\"      Date: 2025
6 .\"    Manual: PostgreSQL 18.0 Documentation
7 .\"    Source: PostgreSQL 18.0
8 .\"  Language: English
9 .\"
10 .TH "DROP AGGREGATE" "7" "2025" "PostgreSQL 18.0" "PostgreSQL 18.0 Documentation"
11 .\" -----------------------------------------------------------------
12 .\" * Define some portability stuff
13 .\" -----------------------------------------------------------------
14 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15 .\" http://bugs.debian.org/507673
16 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
17 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18 .ie \n(.g .ds Aq \(aq
19 .el       .ds Aq '
20 .\" -----------------------------------------------------------------
21 .\" * set default formatting
22 .\" -----------------------------------------------------------------
23 .\" disable hyphenation
24 .nh
25 .\" disable justification (adjust text to left margin only)
26 .ad l
27 .\" -----------------------------------------------------------------
28 .\" * MAIN CONTENT STARTS HERE *
29 .\" -----------------------------------------------------------------
30 .SH "NAME"
31 DROP_AGGREGATE \- remove an aggregate function
32 .SH "SYNOPSIS"
33 .sp
34 .nf
35 DROP AGGREGATE [ IF EXISTS ] \fIname\fR ( \fIaggregate_signature\fR ) [, \&.\&.\&.] [ CASCADE | RESTRICT ]
36
37 where \fIaggregate_signature\fR is:
38
39 * |
40 [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [ , \&.\&.\&. ] |
41 [ [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [ , \&.\&.\&. ] ] ORDER BY [ \fIargmode\fR ] [ \fIargname\fR ] \fIargtype\fR [ , \&.\&.\&. ]
42 .fi
43 .SH "DESCRIPTION"
44 .PP
45 \fBDROP AGGREGATE\fR
46 removes an existing aggregate function\&. To execute this command the current user must be the owner of the aggregate function\&.
47 .SH "PARAMETERS"
48 .PP
49 IF EXISTS
50 .RS 4
51 Do not throw an error if the aggregate does not exist\&. A notice is issued in this case\&.
52 .RE
53 .PP
54 \fIname\fR
55 .RS 4
56 The name (optionally schema\-qualified) of an existing aggregate function\&.
57 .RE
58 .PP
59 \fIargmode\fR
60 .RS 4
61 The mode of an argument:
62 IN
63 or
64 VARIADIC\&. If omitted, the default is
65 IN\&.
66 .RE
67 .PP
68 \fIargname\fR
69 .RS 4
70 The name of an argument\&. Note that
71 \fBDROP AGGREGATE\fR
72 does not actually pay any attention to argument names, since only the argument data types are needed to determine the aggregate function\*(Aqs identity\&.
73 .RE
74 .PP
75 \fIargtype\fR
76 .RS 4
77 An input data type on which the aggregate function operates\&. To reference a zero\-argument aggregate function, write
78 *
79 in place of the list of argument specifications\&. To reference an ordered\-set aggregate function, write
80 ORDER BY
81 between the direct and aggregated argument specifications\&.
82 .RE
83 .PP
84 CASCADE
85 .RS 4
86 Automatically drop objects that depend on the aggregate function (such as views using it), and in turn all objects that depend on those objects (see
87 Section\ \&5.15)\&.
88 .RE
89 .PP
90 RESTRICT
91 .RS 4
92 Refuse to drop the aggregate function if any objects depend on it\&. This is the default\&.
93 .RE
94 .SH "NOTES"
95 .PP
96 Alternative syntaxes for referencing ordered\-set aggregates are described under
97 ALTER AGGREGATE (\fBALTER_AGGREGATE\fR(7))\&.
98 .SH "EXAMPLES"
99 .PP
100 To remove the aggregate function
101 myavg
102 for type
103 integer:
104 .sp
105 .if n \{\
106 .RS 4
107 .\}
108 .nf
109 DROP AGGREGATE myavg(integer);
110 .fi
111 .if n \{\
112 .RE
113 .\}
114 .PP
115 To remove the hypothetical\-set aggregate function
116 myrank, which takes an arbitrary list of ordering columns and a matching list of direct arguments:
117 .sp
118 .if n \{\
119 .RS 4
120 .\}
121 .nf
122 DROP AGGREGATE myrank(VARIADIC "any" ORDER BY VARIADIC "any");
123 .fi
124 .if n \{\
125 .RE
126 .\}
127 .PP
128 To remove multiple aggregate functions in one command:
129 .sp
130 .if n \{\
131 .RS 4
132 .\}
133 .nf
134 DROP AGGREGATE myavg(integer), myavg(bigint);
135 .fi
136 .if n \{\
137 .RE
138 .\}
139 .SH "COMPATIBILITY"
140 .PP
141 There is no
142 \fBDROP AGGREGATE\fR
143 statement in the SQL standard\&.
144 .SH "SEE ALSO"
145 ALTER AGGREGATE (\fBALTER_AGGREGATE\fR(7)), CREATE AGGREGATE (\fBCREATE_AGGREGATE\fR(7))