summaryrefslogtreecommitdiff
path: root/src/backend/nodes
diff options
context:
space:
mode:
authorTom Lane2006-04-15 17:45:46 +0000
committerTom Lane2006-04-15 17:45:46 +0000
commit3651a3e6fb41121f2262577774382e84bf9a3177 (patch)
treee09fb8fcf6851e4625f4eb5595ede6f16367056f /src/backend/nodes
parentebd5257d493ac8a6f20eea667409cf9b06ac3202 (diff)
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')
-rw-r--r--src/backend/nodes/copyfuncs.c37
-rw-r--r--src/backend/nodes/equalfuncs.c33
2 files changed, 10 insertions, 60 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;
diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c
index 8d413b87c58..9aa0b399b7c 100644
--- a/src/backend/nodes/equalfuncs.c
+++ b/src/backend/nodes/equalfuncs.c
@@ -18,7 +18,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.268 2006/03/23 00:19:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/nodes/equalfuncs.c,v 1.269 2006/04/15 17:45:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -909,7 +909,9 @@ static bool
_equalDefineStmt(DefineStmt *a, DefineStmt *b)
{
COMPARE_SCALAR_FIELD(kind);
+ COMPARE_SCALAR_FIELD(oldstyle);
COMPARE_NODE_FIELD(defnames);
+ COMPARE_NODE_FIELD(args);
COMPARE_NODE_FIELD(definition);
return true;
@@ -1007,29 +1009,10 @@ _equalAlterFunctionStmt(AlterFunctionStmt *a, AlterFunctionStmt *b)
}
static bool
-_equalRemoveAggrStmt(RemoveAggrStmt *a, RemoveAggrStmt *b)
-{
- COMPARE_NODE_FIELD(aggname);
- COMPARE_NODE_FIELD(aggtype);
- COMPARE_SCALAR_FIELD(behavior);
-
- return true;
-}
-
-static bool
_equalRemoveFuncStmt(RemoveFuncStmt *a, RemoveFuncStmt *b)
{
- COMPARE_NODE_FIELD(funcname);
- COMPARE_NODE_FIELD(args);
- COMPARE_SCALAR_FIELD(behavior);
-
- return true;
-}
-
-static bool
-_equalRemoveOperStmt(RemoveOperStmt *a, RemoveOperStmt *b)
-{
- COMPARE_NODE_FIELD(opname);
+ COMPARE_SCALAR_FIELD(kind);
+ COMPARE_NODE_FIELD(name);
COMPARE_NODE_FIELD(args);
COMPARE_SCALAR_FIELD(behavior);
@@ -2112,15 +2095,9 @@ equal(void *a, void *b)
case T_AlterFunctionStmt:
retval = _equalAlterFunctionStmt(a, b);
break;
- case T_RemoveAggrStmt:
- retval = _equalRemoveAggrStmt(a, b);
- break;
case T_RemoveFuncStmt:
retval = _equalRemoveFuncStmt(a, b);
break;
- case T_RemoveOperStmt:
- retval = _equalRemoveOperStmt(a, b);
- break;
case T_RemoveOpClassStmt:
retval = _equalRemoveOpClassStmt(a, b);
break;