Hmm, guess I forgot to commit this file the other day ...

just some cosmetic changes now, Vadim already fixed the heap_xxx calls.
This commit is contained in:
Tom Lane 1999-09-30 01:12:36 +00:00
parent 82b1f55239
commit 5fc889fbea
1 changed files with 19 additions and 24 deletions

View File

@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.68 1999/09/29 16:06:11 wieck Exp $ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.69 1999/09/30 01:12:36 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -206,35 +206,30 @@ ProcessUtility(Node *parsetree,
} }
break; break;
case T_TruncateStmt: case T_TruncateStmt:
{ {
Relation rel;
Relation rel; PS_SET_STATUS(commandTag = "TRUNCATE");
CHECK_IF_ABORTED();
PS_SET_STATUS(commandTag = "TRUNCATE"); relname = ((TruncateStmt *) parsetree)->relName;
CHECK_IF_ABORTED(); if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "TRUNCATE cannot be used on system tables. '%s' is a system table",
relname);
relname = ((TruncateStmt *) parsetree)->relName; /* Grab exclusive lock in preparation for truncate... */
if (!allowSystemTableMods && IsSystemRelationName(relname)) { rel = heap_openr(relname, AccessExclusiveLock);
elog(ERROR, "TRUNCATE cannot be used on system tables. '%s' is a system table", if (rel->rd_rel->relkind == RELKIND_SEQUENCE)
relname); elog(ERROR, "TRUNCATE cannot be used on sequences. '%s' is a sequence",
} relname);
rel = heap_openr(relname, AccessExclusiveLock);
if (RelationIsValid(rel)) {
if (rel->rd_rel->relkind == RELKIND_SEQUENCE) {
elog(ERROR, "TRUNCATE cannot be used on sequences. '%s' is a sequence",
relname);
}
heap_close(rel, NoLock); heap_close(rel, NoLock);
}
#ifndef NO_SECURITY #ifndef NO_SECURITY
if (!pg_ownercheck(userName, relname, RELNAME)) { if (!pg_ownercheck(userName, relname, RELNAME))
elog(ERROR, "you do not own class \"%s\"", relname); elog(ERROR, "you do not own class \"%s\"", relname);
}
#endif #endif
TruncateRelation(((TruncateStmt *) parsetree)->relName); TruncateRelation(relname);
} }
break; break;