aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index d90c739952a..2d4dcd75564 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -13683,6 +13683,21 @@ ValidatePartitionConstraints(List **wqueue, Relation scanrel,
/* There can never be a whole-row reference here */
if (found_whole_row)
elog(ERROR, "unexpected whole-row reference found in partition key");
+
+ /* Can we skip scanning this part_rel? */
+ if (PartConstraintImpliedByRelConstraint(part_rel, my_partconstr))
+ {
+ if (!validate_default)
+ ereport(INFO,
+ (errmsg("partition constraint for table \"%s\" is implied by existing constraints",
+ RelationGetRelationName(part_rel))));
+ else
+ ereport(INFO,
+ (errmsg("updated partition constraint for default partition \"%s\" is implied by existing constraints",
+ RelationGetRelationName(part_rel))));
+ heap_close(part_rel, NoLock);
+ continue;
+ }
}
/* Grab a work queue entry. */