aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/comment.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-04-15 17:45:46 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-04-15 17:45:46 +0000
commit3651a3e6fb41121f2262577774382e84bf9a3177 (patch)
treee09fb8fcf6851e4625f4eb5595ede6f16367056f /src/backend/commands/comment.c
parentebd5257d493ac8a6f20eea667409cf9b06ac3202 (diff)
downloadpostgresql-3651a3e6fb41121f2262577774382e84bf9a3177.tar.gz
postgresql-3651a3e6fb41121f2262577774382e84bf9a3177.zip
Support the syntax
CREATE AGGREGATE aggname (input_type) (parameter_list) along with the old syntax where the input type was named in the parameter list. This fits more naturally with the way that the aggregate is identified in DROP AGGREGATE and other utility commands; furthermore it has a natural extension to handle multiple-input aggregates, where the basetype-parameter method would get ugly. In fact, this commit fixes the grammar and all the utility commands to support multiple-input aggregates; but DefineAggregate rejects it because the executor isn't fixed yet. I didn't do anything about treating agg(*) as a zero-input aggregate instead of artificially making it a one-input aggregate, but that should be considered in combination with supporting multi-input aggregates.
Diffstat (limited to 'src/backend/commands/comment.c')
-rw-r--r--src/backend/commands/comment.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/src/backend/commands/comment.c b/src/backend/commands/comment.c
index 07d82785254..ec4762750f9 100644
--- a/src/backend/commands/comment.c
+++ b/src/backend/commands/comment.c
@@ -7,7 +7,7 @@
* Copyright (c) 1996-2006, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.88 2006/03/14 22:48:18 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/comment.c,v 1.89 2006/04/15 17:45:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -868,28 +868,17 @@ CommentType(List *typename, char *comment)
*
* This routine is used to allow a user to provide comments on an
* aggregate function. The aggregate function is determined by both
- * its name and its argument type, which, with the comments are
- * the three parameters handed to this routine.
+ * its name and its argument type(s).
*/
static void
CommentAggregate(List *aggregate, List *arguments, char *comment)
{
- TypeName *aggtype = (TypeName *) linitial(arguments);
- Oid baseoid,
- oid;
-
- /* First, attempt to determine the base aggregate oid */
- if (aggtype)
- baseoid = typenameTypeId(NULL, aggtype);
- else
- baseoid = ANYOID;
-
- /* Now, attempt to find the actual tuple in pg_proc */
+ Oid oid;
- oid = find_aggregate_func(aggregate, baseoid, false);
+ /* Look up function and make sure it's an aggregate */
+ oid = LookupAggNameTypeNames(aggregate, arguments, false);
/* Next, validate the user's attempt to comment */
-
if (!pg_proc_ownercheck(oid, GetUserId()))
aclcheck_error(ACLCHECK_NOT_OWNER, ACL_KIND_PROC,
NameListToString(aggregate));