Re: Cascades Failing

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: Jake Stride <nsuk(at)users(dot)sourceforge(dot)net>, pgsql-general(at)postgresql(dot)org
Subject: Re: Cascades Failing
Date: 2005-08-16 14:34:10
Message-ID: 849.1124202850@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-hackers

Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
> I think this is similar to the issue recently reported on -bugs. My
> theory there was that trigger timing changes between 7.4 and 8.0 seems to
> have caused the sequence of checks inside the trigger manager and triggers
> that prevented intermediate states from being checked to become broken.

Just looking at the example, I think that the issue is that we fire a
trigger for one of the FK constraints, it does an UPDATE to fix the
constraint it knows about, and then on the way out of that UPDATE
statement, check triggers for all of the FK constraints are executed
and the ones that haven't been fixed yet are unhappy. (The failure
occurs because two independent updates are needed on the same row of
the referencing table, and only one has been done yet.) So the problem
comes directly from the fact that FK triggers can fire at the ends of
nested statements, rather than only at the outer level as they did
before.

This suggests that we need a way to prevent immediate execution of
freshly queued triggers at the end of a command fired by an FK trigger.
If we could move them to the end of the trigger queue that the FK
operation itself is in, things would work reasonably well I think.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Matt Miller 2005-08-16 14:46:38 Re: Prevent inserting document without rows
Previous Message Andrus 2005-08-16 14:31:24 Prevent inserting document without rows

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-08-16 15:00:28 Re: [GENERAL] Cascades Failing
Previous Message Richard Huxton 2005-08-16 14:23:15 Re: Cascades Failing in 8.0.x