1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +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:
Tom Lane
2002-09-23 20:43:41 +00:00
parent c99f820053
commit 5fa3418304
5 changed files with 64 additions and 5 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.46 2002/09/04 20:31:14 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/commands/analyze.c,v 1.47 2002/09/23 20:43:40 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -21,6 +21,7 @@
#include "catalog/catalog.h"
#include "catalog/catname.h"
#include "catalog/indexing.h"
#include "catalog/namespace.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_statistic.h"
#include "catalog/pg_type.h"
@ -215,6 +216,19 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt)
return;
}
/*
* Silently ignore tables that are temp tables of other backends ---
* trying to analyze these is rather pointless, 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
* ANALYZE.)
*/
if (isOtherTempNamespace(RelationGetNamespace(onerel)))
{
relation_close(onerel, AccessShareLock);
return;
}
/*
* We can ANALYZE any table except pg_statistic. See update_attstats
*/