summaryrefslogtreecommitdiff
path: root/src/backend/commands/alter.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2006-04-15 17:45:46 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2006-04-15 17:45:46 +0000
commit3651a3e6fb41121f2262577774382e84bf9a3177 (patch)
treee09fb8fcf6851e4625f4eb5595ede6f16367056f /src/backend/commands/alter.c
parentebd5257d493ac8a6f20eea667409cf9b06ac3202 (diff)
downloadpostgresql-3651a3e6fb41121f2262577774382e84bf9a3177.tar.gz
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/commands/alter.c')
-rw-r--r--src/backend/commands/alter.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c
index 3c99fd9e03..2b7c9250b3 100644
--- a/src/backend/commands/alter.c
+++ b/src/backend/commands/alter.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.18 2006/03/05 15:58:23 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.19 2006/04/15 17:45:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,9 +47,7 @@ ExecRenameStmt(RenameStmt *stmt)
switch (stmt->renameType)
{
case OBJECT_AGGREGATE:
- RenameAggregate(stmt->object,
- (TypeName *) linitial(stmt->objarg),
- stmt->newname);
+ RenameAggregate(stmt->object, stmt->objarg, stmt->newname);
break;
case OBJECT_CONVERSION:
@@ -152,8 +150,12 @@ ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt)
switch (stmt->objectType)
{
case OBJECT_AGGREGATE:
+ AlterFunctionNamespace(stmt->object, stmt->objarg, true,
+ stmt->newschema);
+ break;
+
case OBJECT_FUNCTION:
- AlterFunctionNamespace(stmt->object, stmt->objarg,
+ AlterFunctionNamespace(stmt->object, stmt->objarg, false,
stmt->newschema);
break;
@@ -186,9 +188,7 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
switch (stmt->objectType)
{
case OBJECT_AGGREGATE:
- AlterAggregateOwner(stmt->object,
- (TypeName *) linitial(stmt->objarg),
- newowner);
+ AlterAggregateOwner(stmt->object, stmt->objarg, newowner);
break;
case OBJECT_CONVERSION:
@@ -204,6 +204,7 @@ ExecAlterOwnerStmt(AlterOwnerStmt *stmt)
break;
case OBJECT_OPERATOR:
+ Assert(list_length(stmt->objarg) == 2);
AlterOperatorOwner(stmt->object,
(TypeName *) linitial(stmt->objarg),
(TypeName *) lsecond(stmt->objarg),