From: Tom Lane <tgl@sss.pgh.pa.us>
To: Finnerty, Jim <jfinnert@amazon.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: IMMEDIATE constraint enforcement does not comply with the SQL standard
Date: Mon, 08 Oct 2018 17:49:45 -0400
Message-ID: <24593.1539035385@sss.pgh.pa.us> (raw)
In-Reply-To: <DD7C08FE-B246-464D-B8E8-CA07F5835509@amazon.com>
References: <DD7C08FE-B246-464D-B8E8-CA07F5835509@amazon.com>
"Finnerty, Jim" <jfinnert@amazon.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, jfinnert@amazon.com
Subject: Re: IMMEDIATE constraint enforcement does not comply with the SQL standard
In-Reply-To: <24593.1539035385@sss.pgh.pa.us>
References: <DD7C08FE-B246-464D-B8E8-CA07F5835509@amazon.com> <24593.1539035385@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox