mirror of
https://github.com/postgres/postgres.git
synced 2025-06-14 18:42:34 +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:
@ -10,7 +10,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.73 2006/03/14 22:48:18 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.74 2006/04/15 17:45:34 tgl Exp $
|
||||
*
|
||||
* DESCRIPTION
|
||||
* These routines take the parse tree and pick out the
|
||||
@ -678,7 +678,7 @@ CreateFunction(CreateFunctionStmt *stmt)
|
||||
void
|
||||
RemoveFunction(RemoveFuncStmt *stmt)
|
||||
{
|
||||
List *functionName = stmt->funcname;
|
||||
List *functionName = stmt->name;
|
||||
List *argTypes = stmt->args; /* list of TypeName nodes */
|
||||
Oid funcOid;
|
||||
HeapTuple tup;
|
||||
@ -1440,10 +1440,13 @@ DropCastById(Oid castOid)
|
||||
}
|
||||
|
||||
/*
|
||||
* Execute ALTER FUNCTION SET SCHEMA
|
||||
* Execute ALTER FUNCTION/AGGREGATE SET SCHEMA
|
||||
*
|
||||
* These commands are identical except for the lookup procedure, so share code.
|
||||
*/
|
||||
void
|
||||
AlterFunctionNamespace(List *name, List *argtypes, const char *newschema)
|
||||
AlterFunctionNamespace(List *name, List *argtypes, bool isagg,
|
||||
const char *newschema)
|
||||
{
|
||||
Oid procOid;
|
||||
Oid oldNspOid;
|
||||
@ -1455,7 +1458,10 @@ AlterFunctionNamespace(List *name, List *argtypes, const char *newschema)
|
||||
procRel = heap_open(ProcedureRelationId, RowExclusiveLock);
|
||||
|
||||
/* get function OID */
|
||||
procOid = LookupFuncNameTypeNames(name, argtypes, false);
|
||||
if (isagg)
|
||||
procOid = LookupAggNameTypeNames(name, argtypes, false);
|
||||
else
|
||||
procOid = LookupFuncNameTypeNames(name, argtypes, false);
|
||||
|
||||
/* check permissions on function */
|
||||
if (!pg_proc_ownercheck(procOid, GetUserId()))
|
||||
|
Reference in New Issue
Block a user