Fix incorrect trigger-property updating in ALTER CONSTRAINT.
authorTom Lane
Wed, 26 Oct 2016 21:05:06 +0000 (17:05 -0400)
committerTom Lane
Wed, 26 Oct 2016 21:05:06 +0000 (17:05 -0400)
commit3a9a8c40837844bfdfd44c626042670ce076bbba
treef1a5c70b05f4be4d65a0ac81c9e77590a5255dad
parentcfc5cb9efc7b9f62532d25155335997ccec43496
Fix incorrect trigger-property updating in ALTER CONSTRAINT.

The code to change the deferrability properties of a foreign-key constraint
updated all the associated triggers to match; but a moment's examination of
the code that creates those triggers in the first place shows that only
some of them should track the constraint's deferrability properties.  This
leads to odd failures in subsequent exercise of the foreign key, as the
triggers are fired at the wrong times.  Fix that, and add a regression test
comparing the trigger properties produced by ALTER CONSTRAINT with those
you get by creating the constraint as-intended to begin with.

Per report from James Parks.  Back-patch to 9.4 where this ALTER
functionality was introduced.

Report: 
src/backend/commands/tablecmds.c
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql