diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-04 19:54:23 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-03-04 19:54:23 +0000 |
commit | cbcc5b11a819593c3b45ebccaeecea0f631e00f1 (patch) | |
tree | 7b925dd1338163aa6091f0ed8421068f8d9c0672 /src/backend/access/heap/heapam.c | |
parent | a27e4ecda98f6b3f6e586179e3e977d61d99a144 (diff) | |
download | postgresql-cbcc5b11a819593c3b45ebccaeecea0f631e00f1.tar.gz postgresql-cbcc5b11a819593c3b45ebccaeecea0f631e00f1.zip |
Fix PREPARE TRANSACTION to reject the case where the transaction has dropped a
temporary table; we can't support that because there's no way to clean up the
source backend's internal state if the eventual COMMIT PREPARED is done by
another backend. This was checked correctly in 8.1 but I broke it in 8.2 :-(.
Patch by Heikki Linnakangas, original trouble report by John Smith.
Diffstat (limited to 'src/backend/access/heap/heapam.c')
-rw-r--r-- | src/backend/access/heap/heapam.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 1889d09784c..aade7a29c13 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.222.2.1 2007/02/04 20:00:49 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.222.2.2 2008/03/04 19:54:23 tgl Exp $ * * * INTERFACE ROUTINES @@ -699,6 +699,10 @@ relation_open(Oid relationId, LOCKMODE lockmode) if (!RelationIsValid(r)) elog(ERROR, "could not open relation with OID %u", relationId); + /* Make note that we've accessed a temporary relation */ + if (r->rd_istemp) + MyXactAccessedTempRel = true; + return r; } @@ -741,6 +745,10 @@ try_relation_open(Oid relationId, LOCKMODE lockmode) if (!RelationIsValid(r)) elog(ERROR, "could not open relation with OID %u", relationId); + /* Make note that we've accessed a temporary relation */ + if (r->rd_istemp) + MyXactAccessedTempRel = true; + return r; } @@ -785,6 +793,10 @@ relation_open_nowait(Oid relationId, LOCKMODE lockmode) if (!RelationIsValid(r)) elog(ERROR, "could not open relation with OID %u", relationId); + /* Make note that we've accessed a temporary relation */ + if (r->rd_istemp) + MyXactAccessedTempRel = true; + return r; } |