public inbox for [email protected]
help / color / mirror / Atom feedFrom: Justin Pryzby <[email protected]>
Subject: [PATCH] fix
Date: Sun, 10 Jan 2021 15:41:43 -0600
---
src/backend/commands/tablecmds.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d7b9c63e5f..144c27c303 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -17131,6 +17131,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
Oid partrelid,
parentrelid;
LOCKTAG tag;
+ LockRelId partlockrelid;
char *parentrelname;
char *partrelname;
@@ -17162,6 +17163,10 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
table_close(rel, NoLock);
tab->rel = NULL;
+ partlockrelid.relId = parentrelid;
+ partlockrelid.dbId = MyDatabaseId;
+ LockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
+
/* Make updated catalog entry visible */
PopActiveSnapshot();
CommitTransactionCommand();
@@ -17204,7 +17209,7 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel,
errmsg("partition \"%s\" was removed concurrently", partrelname)));
tab->rel = rel;
-
+ UnlockRelationIdForSession(&partlockrelid, ShareUpdateExclusiveLock);
}
/* Do the final part of detaching */
@@ -17444,7 +17449,10 @@ DetachAddConstraintIfNeeded(List **wqueue, Relation partRel)
TupleDesc td = RelationGetDescr(partRel);
Constraint *n;
- constraintExpr = make_ands_explicit(RelationGetPartitionQual(partRel));
+ List *l = RelationGetPartitionQual(partRel);
+ Assert(partRel->rd_rel->relispartition);
+ Assert(l != NIL);
+ constraintExpr = make_ands_explicit(l);
/* If an identical constraint exists, we don't need to create one */
if (td->constr && td->constr->num_check > 0)
--
2.17.0
--kR3zbvD4cgoYnS/6--
view thread (79+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [PATCH] fix
In-Reply-To: <no-message-id-1868017@localhost>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox