Skip to content

Commit 815b20a

Browse files
committed
Restore RI trigger sanity check
I unnecessarily removed this check in 3de241d because I misunderstood what the final representation of constraints across a partitioning hierarchy was to be. Put it back (in both branches). Discussion: https://postgr.es/m/201901222145.t6wws6t6vrcu@alvherre.pgsql
1 parent c1afd17 commit 815b20a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/utils/adt/ri_triggers.c

+7
Original file line numberDiff line numberDiff line change
@@ -1739,6 +1739,13 @@ ri_FetchConstraintInfo(Trigger *trigger, Relation trig_rel, bool rel_is_pk)
17391739
elog(ERROR, "wrong pg_constraint entry for trigger \"%s\" on table \"%s\"",
17401740
trigger->tgname, RelationGetRelationName(trig_rel));
17411741
}
1742+
else
1743+
{
1744+
if (riinfo->fk_relid != RelationGetRelid(trig_rel) ||
1745+
riinfo->pk_relid != trigger->tgconstrrelid)
1746+
elog(ERROR, "wrong pg_constraint entry for trigger \"%s\" on table \"%s\"",
1747+
trigger->tgname, RelationGetRelationName(trig_rel));
1748+
}
17421749

17431750
if (riinfo->confmatchtype != FKCONSTR_MATCH_FULL &&
17441751
riinfo->confmatchtype != FKCONSTR_MATCH_PARTIAL &&

0 commit comments

Comments
 (0)