From 35508d1cca1630e40b157d67b427174c3e1999aa Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 1 Aug 2005 04:03:59 +0000 Subject: Add ALTER object SET SCHEMA capability for a limited but useful set of object kinds (tables, functions, types). Documentation is not here yet. Original code by Bernd Helmle, extensive rework by Bruce Momjian and Tom Lane. --- src/backend/commands/alter.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'src/backend/commands/alter.c') diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c index a19b500152..996d70e163 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.13 2005/06/28 05:08:53 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/alter.c,v 1.14 2005/08/01 04:03:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -142,6 +142,38 @@ ExecRenameStmt(RenameStmt *stmt) } } +/* + * Executes an ALTER OBJECT / SET SCHEMA statement. Based on the object + * type, the function appropriate to that type is executed. + */ +void +ExecAlterObjectSchemaStmt(AlterObjectSchemaStmt *stmt) +{ + switch (stmt->objectType) + { + case OBJECT_AGGREGATE: + case OBJECT_FUNCTION: + AlterFunctionNamespace(stmt->object, stmt->objarg, + stmt->newschema); + break; + + case OBJECT_SEQUENCE: + case OBJECT_TABLE: + CheckRelationOwnership(stmt->relation, true); + AlterTableNamespace(stmt->relation, stmt->newschema); + break; + + case OBJECT_TYPE: + case OBJECT_DOMAIN: + AlterTypeNamespace(stmt->object, stmt->newschema); + break; + + default: + elog(ERROR, "unrecognized AlterObjectSchemaStmt type: %d", + (int) stmt->objectType); + } +} + /* * Executes an ALTER OBJECT / OWNER TO statement. Based on the object * type, the function appropriate to that type is executed. -- cgit v1.2.1