Commit 5fc889fb authored by Tom Lane's avatar Tom Lane

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

just some cosmetic changes now, Vadim already fixed the heap_xxx calls.
parent 82b1f552
......@@ -9,7 +9,7 @@
*
*
* 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 $
*
*-------------------------------------------------------------------------
*/
......@@ -208,33 +208,28 @@ ProcessUtility(Node *parsetree,
case T_TruncateStmt:
{
Relation rel;
PS_SET_STATUS(commandTag = "TRUNCATE");
CHECK_IF_ABORTED();
relname = ((TruncateStmt *) parsetree)->relName;
if (!allowSystemTableMods && IsSystemRelationName(relname)) {
if (!allowSystemTableMods && IsSystemRelationName(relname))
elog(ERROR, "TRUNCATE cannot be used on system tables. '%s' is a system table",
relname);
}
/* Grab exclusive lock in preparation for truncate... */
rel = heap_openr(relname, AccessExclusiveLock);
if (RelationIsValid(rel)) {
if (rel->rd_rel->relkind == RELKIND_SEQUENCE) {
if (rel->rd_rel->relkind == RELKIND_SEQUENCE)
elog(ERROR, "TRUNCATE cannot be used on sequences. '%s' is a sequence",
relname);
}
heap_close(rel, NoLock);
}
#ifndef NO_SECURITY
if (!pg_ownercheck(userName, relname, RELNAME)) {
if (!pg_ownercheck(userName, relname, RELNAME))
elog(ERROR, "you do not own class \"%s\"", relname);
}
#endif
TruncateRelation(((TruncateStmt *) parsetree)->relName);
TruncateRelation(relname);
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment