diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-04-12 20:38:31 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-04-12 20:38:31 +0000 |
commit | 9999f5a10e722c052006886b678995695001958a (patch) | |
tree | ee8b463a3369b5b4283ebb5aa893549de7c3fc45 /src/backend/commands/command.c | |
parent | 79b60cb132824a4939178b3ce9ded5c220a0f179 (diff) | |
download | postgresql-9999f5a10e722c052006886b678995695001958a.tar.gz postgresql-9999f5a10e722c052006886b678995695001958a.zip |
Checking to decide whether relations are system relations now depends
on the namespace not the name; pg_ is not a reserved prefix for table
names anymore. From Fernando Nasser.
Diffstat (limited to 'src/backend/commands/command.c')
-rw-r--r-- | src/backend/commands/command.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c index c74d24cf7a5..c13b2aa67d4 100644 --- a/src/backend/commands/command.c +++ b/src/backend/commands/command.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.173 2002/04/11 23:20:04 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.174 2002/04/12 20:38:20 tgl Exp $ * * NOTES * The PerformAddAttribute() code, like most of the relation @@ -346,7 +346,7 @@ AlterTableAddColumn(Oid myrelid, * normally, only the owner of a class can change its schema. */ if (!allowSystemTableMods - && IsSystemRelationName(RelationGetRelationName(rel))) + && IsSystemRelation(rel)) elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", RelationGetRelationName(rel)); if (!pg_class_ownercheck(myrelid, GetUserId())) @@ -548,7 +548,7 @@ AlterTableAlterColumnDropNotNull(Oid myrelid, RelationGetRelationName(rel)); if (!allowSystemTableMods - && IsSystemRelationName(RelationGetRelationName(rel))) + && IsSystemRelation(rel)) elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", RelationGetRelationName(rel)); @@ -699,7 +699,7 @@ AlterTableAlterColumnSetNotNull(Oid myrelid, RelationGetRelationName(rel)); if (!allowSystemTableMods - && IsSystemRelationName(RelationGetRelationName(rel))) + && IsSystemRelation(rel)) elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", RelationGetRelationName(rel)); @@ -829,7 +829,7 @@ AlterTableAlterColumnDefault(Oid myrelid, RelationGetRelationName(rel)); if (!allowSystemTableMods - && IsSystemRelationName(RelationGetRelationName(rel))) + && IsSystemRelation(rel)) elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", RelationGetRelationName(rel)); @@ -970,8 +970,8 @@ drop_default(Oid relid, int16 attnum) */ void AlterTableAlterColumnFlags(Oid myrelid, - bool inh, const char *colName, - Node *flagValue, const char *flagType) + bool inh, const char *colName, + Node *flagValue, const char *flagType) { Relation rel; int newtarget = 1; @@ -989,9 +989,7 @@ AlterTableAlterColumnFlags(Oid myrelid, /* * we allow statistics case for system tables */ - if (*flagType != 'S' && - !allowSystemTableMods - && IsSystemRelationName(RelationGetRelationName(rel))) + if (*flagType != 'S' && !allowSystemTableMods && IsSystemRelation(rel)) elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", RelationGetRelationName(rel)); @@ -1150,7 +1148,7 @@ AlterTableAddConstraint(Oid myrelid, RelationGetRelationName(rel)); if (!allowSystemTableMods - && IsSystemRelationName(RelationGetRelationName(rel))) + && IsSystemRelation(rel)) elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", RelationGetRelationName(rel)); @@ -1476,7 +1474,7 @@ AlterTableDropConstraint(Oid myrelid, RelationGetRelationName(rel)); if (!allowSystemTableMods - && IsSystemRelationName(RelationGetRelationName(rel))) + && IsSystemRelation(rel)) elog(ERROR, "ALTER TABLE: relation \"%s\" is a system catalog", RelationGetRelationName(rel)); @@ -1952,6 +1950,10 @@ CreateSchemaCommand(CreateSchemaStmt *stmt) owner_name, authId); } + if (!allowSystemTableMods && IsReservedName(schemaName)) + elog(ERROR, "CREATE SCHEMA: Illegal schema name: \"%s\" -- pg_ is reserved for system schemas", + schemaName); + /* Create the schema's namespace */ NamespaceCreate(schemaName, owner_userid); |