1DROP AGGREGATE(7) PostgreSQL 14.3 Documentation DROP AGGREGATE(7)
2
3
4
6 DROP_AGGREGATE - remove an aggregate function
7
9 DROP AGGREGATE [ IF EXISTS ] name ( aggregate_signature ) [, ...] [ CASCADE | RESTRICT ]
10
11 where aggregate_signature is:
12
13 * |
14 [ argmode ] [ argname ] argtype [ , ... ] |
15 [ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]
16
18 DROP AGGREGATE removes an existing aggregate function. To execute this
19 command the current user must be the owner of the aggregate function.
20
22 IF EXISTS
23 Do not throw an error if the aggregate does not exist. A notice is
24 issued in this case.
25
26 name
27 The name (optionally schema-qualified) of an existing aggregate
28 function.
29
30 argmode
31 The mode of an argument: IN or VARIADIC. If omitted, the default is
32 IN.
33
34 argname
35 The name of an argument. Note that DROP AGGREGATE does not actually
36 pay any attention to argument names, since only the argument data
37 types are needed to determine the aggregate function's identity.
38
39 argtype
40 An input data type on which the aggregate function operates. To
41 reference a zero-argument aggregate function, write * in place of
42 the list of argument specifications. To reference an ordered-set
43 aggregate function, write ORDER BY between the direct and
44 aggregated argument specifications.
45
46 CASCADE
47 Automatically drop objects that depend on the aggregate function
48 (such as views using it), and in turn all objects that depend on
49 those objects (see Section 5.14).
50
51 RESTRICT
52 Refuse to drop the aggregate function if any objects depend on it.
53 This is the default.
54
56 Alternative syntaxes for referencing ordered-set aggregates are
57 described under ALTER AGGREGATE (ALTER_AGGREGATE(7)).
58
60 To remove the aggregate function myavg for type integer:
61
62 DROP AGGREGATE myavg(integer);
63
64 To remove the hypothetical-set aggregate function myrank, which takes
65 an arbitrary list of ordering columns and a matching list of direct
66 arguments:
67
68 DROP AGGREGATE myrank(VARIADIC "any" ORDER BY VARIADIC "any");
69
70 To remove multiple aggregate functions in one command:
71
72 DROP AGGREGATE myavg(integer), myavg(bigint);
73
75 There is no DROP AGGREGATE statement in the SQL standard.
76
78 ALTER AGGREGATE (ALTER_AGGREGATE(7)), CREATE AGGREGATE
79 (CREATE_AGGREGATE(7))
80
81
82
83PostgreSQL 14.3 2022 DROP AGGREGATE(7)