1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +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:
Tom Lane
2006-04-15 17:45:46 +00:00
parent ebd5257d49
commit 3651a3e6fb
17 changed files with 395 additions and 351 deletions

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.306 2006/03/23 00:19:30 tgl Exp $
* $PostgreSQL: pgsql/src/include/nodes/parsenodes.h,v 1.307 2006/04/15 17:45:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1242,7 +1242,9 @@ typedef struct DefineStmt
{
NodeTag type;
ObjectType kind; /* aggregate, operator, type */
bool oldstyle; /* hack to signal old CREATE AGG syntax */
List *defnames; /* qualified name (list of Value strings) */
List *args; /* a list of TypeName (if needed) */
List *definition; /* a list of DefElem */
} DefineStmt;
@@ -1456,41 +1458,18 @@ typedef struct AlterFunctionStmt
} AlterFunctionStmt;
/* ----------------------
* Drop Aggregate Statement
* ----------------------
*/
typedef struct RemoveAggrStmt
{
NodeTag type;
List *aggname; /* aggregate to drop */
TypeName *aggtype; /* TypeName for input datatype, or NULL */
DropBehavior behavior; /* RESTRICT or CASCADE behavior */
} RemoveAggrStmt;
/* ----------------------
* Drop Function Statement
* Drop {Function|Aggregate|Operator} Statement
* ----------------------
*/
typedef struct RemoveFuncStmt
{
NodeTag type;
List *funcname; /* function to drop */
ObjectType kind; /* function, aggregate, operator */
List *name; /* qualified name of object to drop */
List *args; /* types of the arguments */
DropBehavior behavior; /* RESTRICT or CASCADE behavior */
} RemoveFuncStmt;
/* ----------------------
* Drop Operator Statement
* ----------------------
*/
typedef struct RemoveOperStmt
{
NodeTag type;
List *opname; /* operator to drop */
List *args; /* types of the arguments */
DropBehavior behavior; /* RESTRICT or CASCADE behavior */
} RemoveOperStmt;
/* ----------------------
* Drop Operator Class Statement
* ----------------------