Michael Paquier <mich...@paquier.xyz> writes: > Okay, that's bad. Wouldn't it be sufficient to use what the caller > passes out as lockmode instead of enforcing AEL though?
No, because at the bottom of that function we're going to do a DROP CONSTRAINT on the old FK constraint, and that needs AEL anyway. If we tried to take a lesser lock first we'd just be creating a lock-upgrade deadlock risk. regards, tom lane