PG Bug reporting form <noreply(at)postgresql(dot)org> writes:
> in lock.c, we can see code Release lock before return , e.g.
> ...
> bug we can see some code doesn't release the lock. Does it may cause
> deadlock?
Transaction cleanup will automatically release all locks (and other
resources too). So the places that do a manual release before
elog(ERROR) are something of a waste of code space. It might be worth
doing that if you're concerned about holding the lock for the minimum
possible amount of time; but usually that's only a consideration for
very heavily-contended spinlocks or LWLocks.
regards, tom lane