From a7d2b28e4ee251b28bc5552cbcb082683fdcd884 Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Thu, 17 Jan 2019 10:25:12 -0500
Subject: [PATCH v4 4/4] Reduce the lock level required to attach a partition.

Previous work makes this safe (hopefully).
---
 src/backend/commands/tablecmds.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index a93b13c2fe..d50519dcf0 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -3652,6 +3652,9 @@ AlterTableGetLockLevel(List *cmds)
 				break;
 
 			case AT_AttachPartition:
+				cmd_lockmode = ShareUpdateExclusiveLock;
+				break;
+
 			case AT_DetachPartition:
 				cmd_lockmode = AccessExclusiveLock;
 				break;
-- 
2.17.2 (Apple Git-113)

