mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
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.
This commit is contained in:
@ -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 $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -775,6 +775,20 @@ vacuum_rel(Oid relid, VacuumStmt *vacstmt, char expected_relkind)
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
Reference in New Issue
Block a user