Fix lock level used for partition when detaching it
authorAlvaro Herrera <[email protected]>
Thu, 20 Dec 2018 19:42:13 +0000 (16:42 -0300)
committerAlvaro Herrera <[email protected]>
Thu, 20 Dec 2018 19:42:13 +0000 (16:42 -0300)
commit1c142612c846cd01ed0615041e09e6fab7d44571
tree5427b7b27ef6902b2b1e908f1948d77ba4ceae14
parent164d439550dd4b29b8c0bf317779ac8d4b4c2d8f
Fix lock level used for partition when detaching it

For probably bogus reasons, we acquire only AccessShareLock on the
partition when we try to detach it from its parent partitioned table.
This can cause ugly things to happen if another transaction is doing
any sort of DDL to the partition concurrently.

Upgrade that lock to ShareUpdateExclusiveLock, which per discussion
seems to be the minimum needed.

Reported by Robert Haas.

Discussion: https://postgr.es/m/CA+TgmoYruJQ+2qnFLtF1xQtr71pdwgfxy3Ziy-TxV28M6pEmyA@mail.gmail.com
src/backend/commands/tablecmds.c