4 ALTER AGGREGATE — change the definition of an aggregate function
8 ALTER AGGREGATE name ( aggregate_signature ) RENAME TO new_name
9 ALTER AGGREGATE name ( aggregate_signature )
10 OWNER TO { new_owner | CURRENT_ROLE | CURRENT_USER | SESSION_USE
12 ALTER AGGREGATE name ( aggregate_signature ) SET SCHEMA new_schema
14 where aggregate_signature is:
17 [ argmode ] [ argname ] argtype [ , ... ] |
18 [ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] a
23 ALTER AGGREGATE changes the definition of an aggregate function.
25 You must own the aggregate function to use ALTER AGGREGATE. To change
26 the schema of an aggregate function, you must also have CREATE
27 privilege on the new schema. To alter the owner, you must be able to
28 SET ROLE to the new owning role, and that role must have CREATE
29 privilege on the aggregate function's schema. (These restrictions
30 enforce that altering the owner doesn't do anything you couldn't do by
31 dropping and recreating the aggregate function. However, a superuser
32 can alter ownership of any aggregate function anyway.)
37 The name (optionally schema-qualified) of an existing aggregate
41 The mode of an argument: IN or VARIADIC. If omitted, the default
45 The name of an argument. Note that ALTER AGGREGATE does not
46 actually pay any attention to argument names, since only the
47 argument data types are needed to determine the aggregate
51 An input data type on which the aggregate function operates. To
52 reference a zero-argument aggregate function, write * in place
53 of the list of argument specifications. To reference an
54 ordered-set aggregate function, write ORDER BY between the
55 direct and aggregated argument specifications.
58 The new name of the aggregate function.
61 The new owner of the aggregate function.
64 The new schema for the aggregate function.
68 The recommended syntax for referencing an ordered-set aggregate is to
69 write ORDER BY between the direct and aggregated argument
70 specifications, in the same style as in CREATE AGGREGATE. However, it
71 will also work to omit ORDER BY and just run the direct and aggregated
72 argument specifications into a single list. In this abbreviated form,
73 if VARIADIC "any" was used in both the direct and aggregated argument
74 lists, write VARIADIC "any" only once.
78 To rename the aggregate function myavg for type integer to my_average:
79 ALTER AGGREGATE myavg(integer) RENAME TO my_average;
81 To change the owner of the aggregate function myavg for type integer to
83 ALTER AGGREGATE myavg(integer) OWNER TO joe;
85 To move the ordered-set aggregate mypercentile with direct argument of
86 type float8 and aggregated argument of type integer into schema
88 ALTER AGGREGATE mypercentile(float8 ORDER BY integer) SET SCHEMA myschema;
91 ALTER AGGREGATE mypercentile(float8, integer) SET SCHEMA myschema;
95 There is no ALTER AGGREGATE statement in the SQL standard.
99 CREATE AGGREGATE, DROP AGGREGATE