Carlos Alves <
carlos.alves@xxxxxxxxxxxxxxx> writes:
I need some help to understand why a transaction wiht a row delete
aquire a AccessExclusiveLock and a row update a ExclusiveLock.
UPDATE can use the weaker lock type if it's not modifying any
column that is part of a unique index. This is to allow concurrency
with foreign-key checks that might wish to grab a read-only (shared)
lock on such a tuple.
A DELETE, or an UPDATE that is modifying key columns, has to
conflict with foreign-key checks.
regards, tom lane