mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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.
This commit is contained in:
@ -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;
|
||||
|
@ -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;
|
||||
@ -1006,30 +1008,11 @@ _equalAlterFunctionStmt(AlterFunctionStmt *a, AlterFunctionStmt *b)
|
||||
return true;
|
||||
}
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user