From 91eb4895bb6c57face2edf30e20e16e6ab942ef1 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 17 Nov 2006 18:00:25 +0000 Subject: Repair two related errors in heap_lock_tuple: it was failing to recognize cases where we already hold the desired lock "indirectly", either via membership in a MultiXact or because the lock was originally taken by a different subtransaction of the current transaction. These cases must be accounted for to avoid needless deadlocks and/or inappropriate replacement of an exclusive lock with a shared lock. Per report from Clarence Gardner and subsequent investigation. --- src/backend/utils/time/tqual.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/backend/utils/time/tqual.c') diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c index 27b712a22ae..4c1c8612c2c 100644 --- a/src/backend/utils/time/tqual.c +++ b/src/backend/utils/time/tqual.c @@ -32,7 +32,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.91.2.1 2005/11/22 18:23:25 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/time/tqual.c,v 1.91.2.2 2006/11/17 18:00:25 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -506,7 +506,10 @@ HeapTupleSatisfiesToast(HeapTupleHeader tuple, Buffer buffer) * HeapTupleUpdated: The tuple was updated by a committed transaction. * * HeapTupleBeingUpdated: The tuple is being updated by an in-progress - * transaction other than the current transaction. + * transaction other than the current transaction. (Note: this includes + * the case where the tuple is share-locked by a MultiXact, even if the + * MultiXact includes the current transaction. Callers that want to + * distinguish that case must test for it themselves.) */ HTSU_Result HeapTupleSatisfiesUpdate(HeapTupleHeader tuple, CommandId curcid, -- cgit v1.2.3