Re: IMMEDIATE constraint enforcement does not comply with the SQL standard

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Finnerty, Jim" <jfinnert(at)amazon(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: IMMEDIATE constraint enforcement does not comply with the SQL standard
Date: 2018-10-08 21:49:45
Message-ID: 24593.1539035385@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Finnerty, Jim" <jfinnert(at)amazon(dot)com> writes:
> PostgreSQL executes AFTER triggers (and constraints) in alphabetical order according to the name assigned to the trigger at creation time; therefore, PostgreSQL permits IMMEDIATE foreign key constraints to be deferred until after AFTER triggers are fired if their name sorts lower than “RI_ConstraintTrigger”. This is a violation of the standard.

We consider that a feature, not a bug. If you want standard-compliant
behavior, don't name your triggers that way. On the other hand, if
you'd like to get something done before FK constraints fire, you have
the option to do so.

(I think this is documented somewhere. If not, there's an opportunity
for documentation improvement.)

The fact that the sort is plain ASCII means that "RI_ConstraintTrigger"
sorts before any lower-case trigger name, so the issue is not as large
as it might otherwise seem.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Jim Finnerty 2018-10-08 22:05:09 Re: IMMEDIATE constraint enforcement does not comply with the SQL standard
Previous Message Finnerty, Jim 2018-10-08 21:35:46 IMMEDIATE constraint enforcement does not comply with the SQL standard