aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/catalog/heap.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 44f7f269ef2..3a8cf53646a 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -2432,6 +2432,17 @@ MergeWithExistingConstraint(Relation rel, char *ccname, Node *expr,
ccname, RelationGetRelationName(rel))));
/*
+ * Must not change an existing inherited constraint to "no
+ * inherit" status. That's because inherited constraints should
+ * be able to propagate to lower-level children.
+ */
+ if (con->coninhcount > 0 && is_no_inherit)
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
+ errmsg("constraint \"%s\" conflicts with inherited constraint on relation \"%s\"",
+ ccname, RelationGetRelationName(rel))));
+
+ /*
* If the child constraint is "not valid" then cannot merge with a
* valid parent constraint
*/