diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-01 04:03:59 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-08-01 04:03:59 +0000 |
commit | 35508d1cca1630e40b157d67b427174c3e1999aa (patch) | |
tree | 5779ce1a2a645766399fddf8761ef70e388bbc93 /src/backend/commands/alter.c | |
parent | a85e5d1b1b346e039aef61d23775dd1f2ff547ae (diff) | |
download | postgresql-35508d1cca1630e40b157d67b427174c3e1999aa.tar.gz postgresql-35508d1cca1630e40b157d67b427174c3e1999aa.zip |
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.
Diffstat (limited to 'src/backend/commands/alter.c')
-rw-r--r-- | src/backend/commands/alter.c | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/src/backend/commands/alter.c b/src/backend/commands/alter.c index a19b500152d..996d70e1632 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 $ * *------------------------------------------------------------------------- */ @@ -143,6 +143,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. */ |