diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2002-09-23 20:43:41 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2002-09-23 20:43:41 +0000 |
commit | 5fa3418304b06967fa54052b183bf96e1193d85e (patch) | |
tree | 46db71d9ad35150dcd5c53cb9cfe4d6db590a12e /src/backend/commands/tablecmds.c | |
parent | c99f82005320baffd5d0a976f247090a94873986 (diff) | |
download | postgresql-5fa3418304b06967fa54052b183bf96e1193d85e.tar.gz postgresql-5fa3418304b06967fa54052b183bf96e1193d85e.zip |
Disallow VACUUM, ANALYZE, TRUNCATE on temp tables belonging to other
backends. Given that temp tables now store data locally in the local
buffer manager, these things are not going to work safely.
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r-- | src/backend/commands/tablecmds.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index 7b2bab71c34..0934a274c7a 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.43 2002/09/22 19:42:50 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v 1.44 2002/09/23 20:43:40 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -367,6 +367,7 @@ TruncateRelation(const RangeVar *relation) RelationGetRelationName(rel)); } + /* Permissions checks */ if (!allowSystemTableMods && IsSystemRelation(rel)) elog(ERROR, "TRUNCATE cannot be used on system tables. '%s' is a system table", RelationGetRelationName(rel)); @@ -375,6 +376,13 @@ TruncateRelation(const RangeVar *relation) aclcheck_error(ACLCHECK_NOT_OWNER, RelationGetRelationName(rel)); /* + * Don't allow truncate on temp tables of other backends ... their + * local buffer manager is not going to cope. + */ + if (isOtherTempNamespace(RelationGetNamespace(rel))) + elog(ERROR, "TRUNCATE cannot be used on temp tables of other processes"); + + /* * Don't allow truncate on tables which are referenced by foreign keys */ fkeyRel = heap_openr(ConstraintRelationName, AccessShareLock); |