diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c index bbd444745fd..09a8ac15784 100644 --- a/src/backend/storage/lmgr/lock.c +++ b/src/backend/storage/lmgr/lock.c @@ -2305,6 +2305,16 @@ LockReleaseAll(LOCKMETHODID lockmethodid, bool allLocks) locallock->numLockOwners = 0; } +#ifdef USE_ASSERT_CHECKING + + /* + * Tuple locks are currently held only for short durations within a + * transaction. Check that we didn't forget to release one. + */ + if (LOCALLOCK_LOCKTAG(*locallock) == LOCKTAG_TUPLE && !allLocks) + elog(WARNING, "tuple lock held at commit"); +#endif + /* * If the lock or proclock pointers are NULL, this lock was taken via * the relation fast-path (and is not known to have been transferred).