mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
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.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.249 2008/01/30 18:35:55 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.250 2008/03/04 19:54:06 tgl Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@ -868,6 +868,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;
|
||||
|
||||
pgstat_initstats(r);
|
||||
|
||||
return r;
|
||||
@ -912,6 +916,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;
|
||||
|
||||
pgstat_initstats(r);
|
||||
|
||||
return r;
|
||||
@ -958,6 +966,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;
|
||||
|
||||
pgstat_initstats(r);
|
||||
|
||||
return r;
|
||||
|
Reference in New Issue
Block a user