diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-15 17:45:46 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2006-04-15 17:45:46 +0000 |
commit | 3651a3e6fb41121f2262577774382e84bf9a3177 (patch) | |
tree | e09fb8fcf6851e4625f4eb5595ede6f16367056f /src/backend/nodes/copyfuncs.c | |
parent | ebd5257d493ac8a6f20eea667409cf9b06ac3202 (diff) | |
download | postgresql-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/nodes/copyfuncs.c')
-rw-r--r-- | src/backend/nodes/copyfuncs.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c index c7e2a7fff86..cd8ebe1f5d6 100644 --- a/src/backend/nodes/copyfuncs.c +++ b/src/backend/nodes/copyfuncs.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.332 2006/03/23 00:19:29 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/copyfuncs.c,v 1.333 2006/04/15 17:45:34 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1942,7 +1942,9 @@ _copyDefineStmt(DefineStmt *from) DefineStmt *newnode = makeNode(DefineStmt); COPY_SCALAR_FIELD(kind); + COPY_SCALAR_FIELD(oldstyle); COPY_NODE_FIELD(defnames); + COPY_NODE_FIELD(args); COPY_NODE_FIELD(definition); return newnode; @@ -2055,36 +2057,13 @@ _copyAlterFunctionStmt(AlterFunctionStmt *from) return newnode; } -static RemoveAggrStmt * -_copyRemoveAggrStmt(RemoveAggrStmt *from) -{ - RemoveAggrStmt *newnode = makeNode(RemoveAggrStmt); - - COPY_NODE_FIELD(aggname); - COPY_NODE_FIELD(aggtype); - COPY_SCALAR_FIELD(behavior); - - return newnode; -} - static RemoveFuncStmt * _copyRemoveFuncStmt(RemoveFuncStmt *from) { RemoveFuncStmt *newnode = makeNode(RemoveFuncStmt); - COPY_NODE_FIELD(funcname); - COPY_NODE_FIELD(args); - COPY_SCALAR_FIELD(behavior); - - return newnode; -} - -static RemoveOperStmt * -_copyRemoveOperStmt(RemoveOperStmt *from) -{ - RemoveOperStmt *newnode = makeNode(RemoveOperStmt); - - COPY_NODE_FIELD(opname); + COPY_SCALAR_FIELD(kind); + COPY_NODE_FIELD(name); COPY_NODE_FIELD(args); COPY_SCALAR_FIELD(behavior); @@ -3092,15 +3071,9 @@ copyObject(void *from) case T_AlterFunctionStmt: retval = _copyAlterFunctionStmt(from); break; - case T_RemoveAggrStmt: - retval = _copyRemoveAggrStmt(from); - break; case T_RemoveFuncStmt: retval = _copyRemoveFuncStmt(from); break; - case T_RemoveOperStmt: - retval = _copyRemoveOperStmt(from); - break; case T_RemoveOpClassStmt: retval = _copyRemoveOpClassStmt(from); break; |