diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-15 19:15:47 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-15 19:15:47 +0000 |
commit | 9cb84097623e5efe32b7289ca3c403f70ee152d8 (patch) | |
tree | c56de88ec254e2f020e27a431c0aa3ade704a633 /src/backend/utils/adt/ri_triggers.c | |
parent | 5ff95e6b8e19cef5e7fd15368194da1d29ebb0be (diff) | |
download | postgresql-9cb84097623e5efe32b7289ca3c403f70ee152d8.tar.gz postgresql-9cb84097623e5efe32b7289ca3c403f70ee152d8.zip |
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.
Diffstat (limited to 'src/backend/utils/adt/ri_triggers.c')
-rw-r--r-- | src/backend/utils/adt/ri_triggers.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/utils/adt/ri_triggers.c b/src/backend/utils/adt/ri_triggers.c index 3f257f375f4..9add8f934d8 100644 --- a/src/backend/utils/adt/ri_triggers.c +++ b/src/backend/utils/adt/ri_triggers.c @@ -15,7 +15,7 @@ * * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * - * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.95 2007/06/05 21:31:06 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ri_triggers.c,v 1.96 2007/08/15 19:15:46 tgl Exp $ * * ---------- */ @@ -2774,7 +2774,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel) NULL, NULL, CopySnapshot(GetLatestSnapshot()), InvalidSnapshot, - true, 1); + true, false, 1); /* Check result */ if (spi_result != SPI_OK_SELECT) @@ -3308,7 +3308,7 @@ ri_PerformCheck(RI_QueryKey *qkey, SPIPlanPtr qplan, spi_result = SPI_execute_snapshot(qplan, vals, nulls, test_snapshot, crosscheck_snapshot, - false, limit); + false, false, limit); /* Restore UID */ SetUserId(save_uid); |