diff options
Diffstat (limited to 'src/backend')
| -rw-r--r-- | src/backend/commands/tablecmds.c | 50 |
1 files changed, 0 insertions, 50 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c index fc89352b661..5fd8b51312c 100644 --- a/src/backend/commands/tablecmds.c +++ b/src/backend/commands/tablecmds.c @@ -722,7 +722,6 @@ static void QueuePartitionConstraintValidation(List **wqueue, Relation scanrel, List *partConstraint, bool validate_default); static void CloneRowTriggersToPartition(Relation parent, Relation partition); -static void DetachAddConstraintIfNeeded(List **wqueue, Relation partRel); static void DropClonedTriggersFromPartition(Oid partitionId); static ObjectAddress ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel, RangeVar *name, @@ -20942,12 +20941,6 @@ ATExecDetachPartition(List **wqueue, AlteredTableInfo *tab, Relation rel, char *partrelname; /* - * Add a new constraint to the partition being detached, which - * supplants the partition constraint (unless there is one already). - */ - DetachAddConstraintIfNeeded(wqueue, partRel); - - /* * We're almost done now; the only traces that remain are the * pg_inherits tuple and the partition's relpartbounds. Before we can * remove those, we need to wait until all transactions that know that @@ -21404,49 +21397,6 @@ ATExecDetachPartitionFinalize(Relation rel, RangeVar *name) } /* - * DetachAddConstraintIfNeeded - * Subroutine for ATExecDetachPartition. Create a constraint that - * takes the place of the partition constraint, but avoid creating - * a dupe if a constraint already exists which implies the needed - * constraint. - */ -static void -DetachAddConstraintIfNeeded(List **wqueue, Relation partRel) -{ - List *constraintExpr; - - constraintExpr = RelationGetPartitionQual(partRel); - constraintExpr = (List *) eval_const_expressions(NULL, (Node *) constraintExpr); - - /* - * Avoid adding a new constraint if the needed constraint is implied by an - * existing constraint - */ - if (!PartConstraintImpliedByRelConstraint(partRel, constraintExpr)) - { - AlteredTableInfo *tab; - Constraint *n; - - tab = ATGetQueueEntry(wqueue, partRel); - - /* Add constraint on partition, equivalent to the partition constraint */ - n = makeNode(Constraint); - n->contype = CONSTR_CHECK; - n->conname = NULL; - n->location = -1; - n->is_no_inherit = false; - n->raw_expr = NULL; - n->cooked_expr = nodeToString(make_ands_explicit(constraintExpr)); - n->is_enforced = true; - n->initially_valid = true; - n->skip_validation = true; - /* It's a re-add, since it nominally already exists */ - ATAddCheckNNConstraint(wqueue, tab, partRel, n, - true, false, true, ShareUpdateExclusiveLock); - } -} - -/* * DropClonedTriggersFromPartition * subroutine for ATExecDetachPartition to remove any triggers that were * cloned to the partition when it was created-as-partition or attached. |
