aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2018-12-20 16:42:13 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2018-12-20 16:42:13 -0300
commit053ad56d275d343b407bc5fd389bad6f3e340562 (patch)
tree9e45fbc2563956a1d4b8c3ede1a79cb705cc9daa
parent4e4c0d66866c0d54ec33ef987204cdec729a741b (diff)
downloadpostgresql-053ad56d275d343b407bc5fd389bad6f3e340562.tar.gz
postgresql-053ad56d275d343b407bc5fd389bad6f3e340562.zip
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
-rw-r--r--src/backend/commands/tablecmds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 6543eedc3a3..1dae3563605 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -14726,7 +14726,7 @@ ATExecDetachPartition(Relation rel, RangeVar *name)
if (OidIsValid(defaultPartOid))
LockRelationOid(defaultPartOid, AccessExclusiveLock);
- partRel = heap_openrv(name, AccessShareLock);
+ partRel = heap_openrv(name, ShareUpdateExclusiveLock);
/* All inheritance related checks are performed within the function */
RemoveInheritance(partRel, rel);