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/vacuum.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/vacuum.c')
-rw-r--r-- | src/backend/commands/vacuum.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 42172ac07b4..04c13be4e07 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.239 2002/09/23 00:42:48 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.240 2002/09/23 20:43:41 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -776,6 +776,20 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind) } /* + * Silently ignore tables that are temp tables of other backends --- + * trying to vacuum these will lead to great unhappiness, since their + * contents are probably not up-to-date on disk. (We don't throw a + * warning here; it would just lead to chatter during a database-wide + * VACUUM.) + */ + if (isOtherTempNamespace(RelationGetNamespace(onerel))) + { + relation_close(onerel, lmode); + CommitTransactionCommand(true); + return; + } + + /* * Get a session-level lock too. This will protect our access to the * relation across multiple transactions, so that we can vacuum the * relation's TOAST table (if any) secure in the knowledge that no one |