pgsql: Fix lock level used for partition when detaching it

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix lock level used for partition when detaching it
Date: 2018-12-20 19:44:48
Message-ID: E1ga4FU-0005Cw-8i@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Branch
------
REL_10_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/1c142612c846cd01ed0615041e09e6fab7d44571

Modified Files
--------------
src/backend/commands/tablecmds.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2018-12-20 21:22:11 pgsql: Base information_schema.sql_identifier domain on name, not varch
Previous Message Tom Lane 2018-12-20 18:55:33 pgsql: Doc: fix ancient mistake in search_path documentation.