Content-Length: 259316 | pFad | http://github.com/postgrespro/postgres_cluster/commit/7b14bcc06cc56b110118fba408f4b9b72a663387

4A Fix lock level used for partition when detaching it · postgrespro/postgres_cluster@7b14bcc · GitHub
Skip to content

Commit 7b14bcc

Browse files
committed
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
1 parent 42bdf85 commit 7b14bcc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/commands/tablecmds.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14588,7 +14588,7 @@ ATExecDetachPartition(Relation rel, RangeVar *name)
1458814588
if (OidIsValid(defaultPartOid))
1458914589
LockRelationOid(defaultPartOid, AccessExclusiveLock);
1459014590

14591-
partRel = heap_openrv(name, AccessShareLock);
14591+
partRel = heap_openrv(name, ShareUpdateExclusiveLock);
1459214592

1459314593
/* All inheritance related checks are performed within the function */
1459414594
RemoveInheritance(partRel, rel);

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres_cluster/commit/7b14bcc06cc56b110118fba408f4b9b72a663387

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy