Re: AFTER triggers and constraints - Mailing list pgsql-general

From Tom Lane
Subject Re: AFTER triggers and constraints
Date
Msg-id 7609.1372428612@sss.pgh.pa.us
Whole thread Raw
In response to AFTER triggers and constraints  (David Greco <David_Greco@harte-hanks.com>)
Responses Re: AFTER triggers and constraints
List pgsql-general
David Greco <David_Greco@harte-hanks.com> writes:
> Since the trigger is defined as AFTER ROW, versus AFTER STATEMENT, I believe the trigger should be considered part of
thestatement, therefore the constraint should not be checked until after the row triggers have run. Any thoughts? 

Not sure that this is terribly well documented, but you can arrange for
your triggers to fire before the FK-enforcement triggers.  Triggers on
the same table and event type fire in alphabetical (in ASCII) order, so
just choose a name that's before the FK triggers, which if memory serves
have names starting with "RI_".  So for instance
    CREATE TRIGGER "Parent_ar_trg" ...
would have worked the way you want.

            regards, tom lane


pgsql-general by date:

Previous
From: David Greco
Date:
Subject: Re: AFTER triggers and constraints
Next
From: David Greco
Date:
Subject: Re: AFTER triggers and constraints