1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

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.
This commit is contained in:
Tom Lane
2002-04-12 20:38:31 +00:00
parent 79b60cb132
commit 9999f5a10e
22 changed files with 198 additions and 126 deletions

View File

@@ -10,7 +10,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.147 2002/04/12 09:17:10 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.148 2002/04/12 20:38:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -127,7 +127,7 @@ CheckDropPermissions(RangeVar *rel, char rightkind)
elog(ERROR, "you do not own %s \"%s\"",
rentry->name, rel->relname);
if (!allowSystemTableMods && IsSystemRelationName(rel->relname))
if (!allowSystemTableMods && IsSystemClass(classform))
elog(ERROR, "%s \"%s\" is a system %s",
rentry->name, rel->relname, rentry->name);
@@ -153,7 +153,8 @@ CheckOwnership(RangeVar *rel, bool noCatalogs)
if (noCatalogs)
{
if (!allowSystemTableMods && IsSystemRelationName(rel->relname))
if (!allowSystemTableMods &&
IsSystemClass((Form_pg_class) GETSTRUCT(tuple)))
elog(ERROR, "relation \"%s\" is a system catalog",
rel->relname);
}
@@ -791,15 +792,6 @@ ProcessUtility(Node *parsetree,
{
case INDEX:
relname = (char *) stmt->relation->relname;
if (IsSystemRelationName(relname))
{
if (!allowSystemTableMods)
elog(ERROR, "\"%s\" is a system index. call REINDEX under standalone postgres with -O -P options",
relname);
if (!IsIgnoringSystemIndexes())
elog(ERROR, "\"%s\" is a system index. call REINDEX under standalone postgres with -P -O options",
relname);
}
CheckOwnership(stmt->relation, false);
ReindexIndex(stmt->relation, stmt->force);
break;
@@ -809,10 +801,6 @@ ProcessUtility(Node *parsetree,
break;
case DATABASE:
relname = (char *) stmt->name;
if (!allowSystemTableMods)
elog(ERROR, "must be called under standalone postgres with -O -P options");
if (!IsIgnoringSystemIndexes())
elog(ERROR, "must be called under standalone postgres with -P -O options");
ReindexDatabase(relname, stmt->force, false);
break;
}