From 948d6ec90fd35d6e1a59d0b1af8d6efd8442f0ad Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 31 Mar 2009 22:12:48 +0000 Subject: 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. --- src/backend/commands/copy.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/backend/commands/copy.c') diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 611a343e3f9..90ceb77bbbe 100644 --- a/src/backend/commands/copy.c +++ b/src/backend/commands/copy.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.306 2009/03/26 19:24:54 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.307 2009/03/31 22:12:46 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1001,8 +1001,7 @@ DoCopy(const CopyStmt *stmt, const char *queryString) } /* check read-only transaction */ - if (XactReadOnly && is_from && - !isTempNamespace(RelationGetNamespace(cstate->rel))) + if (XactReadOnly && is_from && !cstate->rel->rd_islocaltemp) ereport(ERROR, (errcode(ERRCODE_READ_ONLY_SQL_TRANSACTION), errmsg("transaction is read-only"))); -- cgit v1.2.3