Modify the relcache to record the temp status of both local and nonlocal
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 Mar 2009 22:12:48 +0000 (22:12 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 31 Mar 2009 22:12:48 +0000 (22:12 +0000)
commit5dc3e3b1a4789ec4094339e2d0ce29068f9951d3
tree688f644cac313e31896ea49e27062fb07d0b8aa4
parent6d81ebf8a327fac5af8b79b754edd4bdf53553f1
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.
14 files changed:
src/backend/catalog/index.c
src/backend/catalog/namespace.c
src/backend/catalog/toasting.c
src/backend/commands/analyze.c
src/backend/commands/cluster.c
src/backend/commands/copy.c
src/backend/commands/indexcmds.c
src/backend/commands/tablecmds.c
src/backend/commands/vacuum.c
src/backend/optimizer/prep/prepunion.c
src/backend/postmaster/autovacuum.c
src/backend/storage/buffer/bufmgr.c
src/backend/utils/cache/relcache.c
src/include/utils/rel.h