Repair problems occurring when multiple RI updates have to be done to the same
authorTom Lane <[email protected]>
Wed, 15 Aug 2007 19:15:55 +0000 (19:15 +0000)
committerTom Lane <[email protected]>
Wed, 15 Aug 2007 19:15:55 +0000 (19:15 +0000)
commitd24976d17e5a4df450f00511ba3b2a04aea63872
tree7ad349a31c1b128ed21682a4ba3f603402c47ffb
parent2a1837fbdc5d4da9645ed34998e5bdf6c948ed5e
Repair problems occurring when multiple RI updates have to be done to the same
row within one query: we were firing check triggers before all the updates
were done, leading to bogus failures.  Fix by making the triggers queued by
an RI update go at the end of the outer query's trigger event list, thereby
effectively making the processing "breadth-first".  This was indeed how it
worked pre-8.0, so the bug does not occur in the 7.x branches.
Per report from Pavel Stehule.
src/backend/commands/trigger.c
src/backend/executor/spi.c
src/backend/utils/adt/ri_triggers.c
src/include/executor/spi.h
src/test/regress/expected/foreign_key.out
src/test/regress/sql/foreign_key.sql