diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-03-31 22:12:48 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-03-31 22:12:48 +0000 |
commit | 948d6ec90fd35d6e1a59d0b1af8d6efd8442f0ad (patch) | |
tree | c9184787540c4daa3ae880ea8969d77140a40a5b /src/backend/commands/cluster.c | |
parent | 84a059abf75019f56eba51f33f90b018df8c1116 (diff) | |
download | postgresql-948d6ec90fd35d6e1a59d0b1af8d6efd8442f0ad.tar.gz postgresql-948d6ec90fd35d6e1a59d0b1af8d6efd8442f0ad.zip |
Modify the relcache to record the temp status of both local and nonlocal
temp relations; this is no more expensive than before, now that we have
pg_class.relistemp. Insert tests into bufmgr.c to prevent attempting
to fetch pages from nonlocal temp relations. This provides a low-level
defense against bugs-of-omission allowing temp pages to be loaded into shared
buffers, as in the contrib/pgstattuple problem reported by Stuart Bishop.
While at it, tweak a bunch of places to use new relcache tests (instead of
expensive probes into pg_namespace) to detect local or nonlocal temp tables.
Diffstat (limited to 'src/backend/commands/cluster.c')
-rw-r--r-- | src/backend/commands/cluster.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 6f578440da8..18f316dd517 100644 --- a/src/backend/commands/cluster.c +++ b/src/backend/commands/cluster.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.182 2009/02/02 19:31:38 alvherre Exp $ + * $PostgreSQL: pgsql/src/backend/commands/cluster.c,v 1.183 2009/03/31 22:12:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -117,7 +117,7 @@ cluster(ClusterStmt *stmt, bool isTopLevel) * Reject clustering a remote temp table ... their local buffer * manager is not going to cope. */ - if (isOtherTempNamespace(RelationGetNamespace(rel))) + if (RELATION_IS_OTHER_TEMP(rel)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot cluster temporary tables of other sessions"))); @@ -302,7 +302,7 @@ cluster_rel(RelToCluster *rvtc, bool recheck, bool verbose) * check_index_is_clusterable which is redundant, but we leave it for * extra safety. */ - if (isOtherTempNamespace(RelationGetNamespace(OldHeap))) + if (RELATION_IS_OTHER_TEMP(OldHeap)) { relation_close(OldHeap, AccessExclusiveLock); return; @@ -465,7 +465,7 @@ check_index_is_clusterable(Relation OldHeap, Oid indexOid, bool recheck) * Don't allow cluster on temp tables of other backends ... their local * buffer manager is not going to cope. */ - if (isOtherTempNamespace(RelationGetNamespace(OldHeap))) + if (RELATION_IS_OTHER_TEMP(OldHeap)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("cannot cluster temporary tables of other sessions"))); |