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/analyze.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/analyze.c')
-rw-r--r-- | src/backend/commands/analyze.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c index 5c20b05447e..4c06a28621a 100644 --- a/src/backend/commands/analyze.c +++ b/src/backend/commands/analyze.c @@ -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" @@ -216,6 +217,19 @@ analyze_rel(Oid relid, VacuumStmt *vacstmt) } /* + * 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 */ if (IsSystemNamespace(RelationGetNamespace(onerel)) && |