diff options
author | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-03-20 17:28:43 -0300 |
---|---|---|
committer | Alvaro Herrera <alvherre@alvh.no-ip.org> | 2019-03-20 17:28:43 -0300 |
commit | 815b20ae0c6ed61a431fba124c736152f0df5022 (patch) | |
tree | 5b93a874ad1dccd579f590776ec6f9cb8aaa95f7 | |
parent | c1afd175b5b2e5c44f6da34988342e00ecdfb518 (diff) | |
download | postgresql-815b20ae0c6ed61a431fba124c736152f0df5022.tar.gz postgresql-815b20ae0c6ed61a431fba124c736152f0df5022.zip |
Restore RI trigger sanity check
I unnecessarily removed this check in 3de241dba86f 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
-rw-r--r-- | src/backend/utils/adt/ri_triggers.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index b4d0029877b..6d443db7e2f 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -1739,6 +1739,13 @@ ri_FetchConstraintInfo(Trigger *trigger, Relation trig_rel, bool rel_is_pk) elog(ERROR, "wrong pg_constraint entry for trigger \"%s\" on table \"%s\"", trigger->tgname, RelationGetRelationName(trig_rel)); } + else + { + if (riinfo->fk_relid != RelationGetRelid(trig_rel) || + riinfo->pk_relid != trigger->tgconstrrelid) + elog(ERROR, "wrong pg_constraint entry for trigger \"%s\" on table \"%s\"", + trigger->tgname, RelationGetRelationName(trig_rel)); + } if (riinfo->confmatchtype != FKCONSTR_MATCH_FULL && riinfo->confmatchtype != FKCONSTR_MATCH_PARTIAL && |