diff options
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 163242f54eb..9f86910a6bf 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -1610,6 +1610,15 @@ ExecRelCheck(ResultRelInfo *resultRelInfo, int i; /* + * CheckConstraintFetch let this pass with only a warning, but now we + * should fail rather than possibly failing to enforce an important + * constraint. + */ + if (ncheck != rel->rd_rel->relchecks) + elog(ERROR, "%d pg_constraint record(s) missing for relation \"%s\"", + rel->rd_rel->relchecks - ncheck, RelationGetRelationName(rel)); + + /* * If first time through for this result relation, build expression * nodetrees for rel's constraint expressions. Keep them in the per-query * memory context so they'll survive throughout the query. @@ -1862,7 +1871,7 @@ ExecConstraints(ResultRelInfo *resultRelInfo, } } - if (constr->num_check > 0) + if (rel->rd_rel->relchecks > 0) { const char *failed; |