1ALTER AGGREGATE(7)       PostgreSQL 11.3 Documentation      ALTER AGGREGATE(7)
2
3
4

NAME

6       ALTER_AGGREGATE - change the definition of an aggregate function
7

SYNOPSIS

9       ALTER AGGREGATE name ( aggregate_signature ) RENAME TO new_name
10       ALTER AGGREGATE name ( aggregate_signature )
11                       OWNER TO { new_owner | CURRENT_USER | SESSION_USER }
12       ALTER AGGREGATE name ( aggregate_signature ) SET SCHEMA new_schema
13
14       where aggregate_signature is:
15
16       * |
17       [ argmode ] [ argname ] argtype [ , ... ] |
18       [ [ argmode ] [ argname ] argtype [ , ... ] ] ORDER BY [ argmode ] [ argname ] argtype [ , ... ]
19

DESCRIPTION

21       ALTER AGGREGATE changes the definition of an aggregate function.
22
23       You must own the aggregate function to use ALTER AGGREGATE. To change
24       the schema of an aggregate function, you must also have CREATE
25       privilege on the new schema. To alter the owner, you must also be a
26       direct or indirect member of the new owning role, and that role must
27       have CREATE privilege on the aggregate function's schema. (These
28       restrictions enforce that altering the owner doesn't do anything you
29       couldn't do by dropping and recreating the aggregate function. However,
30       a superuser can alter ownership of any aggregate function anyway.)
31

PARAMETERS

33       name
34           The name (optionally schema-qualified) of an existing aggregate
35           function.
36
37       argmode
38           The mode of an argument: IN or VARIADIC. If omitted, the default is
39           IN.
40
41       argname
42           The name of an argument. Note that ALTER AGGREGATE does not
43           actually pay any attention to argument names, since only the
44           argument data types are needed to determine the aggregate
45           function's identity.
46
47       argtype
48           An input data type on which the aggregate function operates. To
49           reference a zero-argument aggregate function, write * in place of
50           the list of argument specifications. To reference an ordered-set
51           aggregate function, write ORDER BY between the direct and
52           aggregated argument specifications.
53
54       new_name
55           The new name of the aggregate function.
56
57       new_owner
58           The new owner of the aggregate function.
59
60       new_schema
61           The new schema for the aggregate function.
62

NOTES

64       The recommended syntax for referencing an ordered-set aggregate is to
65       write ORDER BY between the direct and aggregated argument
66       specifications, in the same style as in CREATE AGGREGATE
67       (CREATE_AGGREGATE(7)). However, it will also work to omit ORDER BY and
68       just run the direct and aggregated argument specifications into a
69       single list. In this abbreviated form, if VARIADIC "any" was used in
70       both the direct and aggregated argument lists, write VARIADIC "any"
71       only once.
72

EXAMPLES

74       To rename the aggregate function myavg for type integer to my_average:
75
76           ALTER AGGREGATE myavg(integer) RENAME TO my_average;
77
78       To change the owner of the aggregate function myavg for type integer to
79       joe:
80
81           ALTER AGGREGATE myavg(integer) OWNER TO joe;
82
83       To move the ordered-set aggregate mypercentile with direct argument of
84       type float8 and aggregated argument of type integer into schema
85       myschema:
86
87           ALTER AGGREGATE mypercentile(float8 ORDER BY integer) SET SCHEMA myschema;
88
89       This will work too:
90
91           ALTER AGGREGATE mypercentile(float8, integer) SET SCHEMA myschema;
92

COMPATIBILITY

94       There is no ALTER AGGREGATE statement in the SQL standard.
95

SEE ALSO

97       CREATE AGGREGATE (CREATE_AGGREGATE(7)), DROP AGGREGATE
98       (DROP_AGGREGATE(7))
99
100
101
102PostgreSQL 11.3                      2019                   ALTER AGGREGATE(7)
Impressum