Re: [BUGS] Deferrable constraint execution not respecting "initially immediate"? - Mailing list pgsql-bugs

From David G. Johnston
Subject Re: [BUGS] Deferrable constraint execution not respecting "initially immediate"?
Date
Msg-id CAKFQuwb8oHS1zfdGOqYaWzrXAmduS-5zJ_iYbo54m3pEubpo1A@mail.gmail.com
Whole thread Raw
In response to Re: [BUGS] Deferrable constraint execution not respecting "initially immediate"?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Mon, Jul 10, 2017 at 10:25 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> From "CREATE TABLE":
> "A constraint that is not deferrable will be checked immediately after
> every command."

> I think the above should be "after every row" instead of "after every
> command".

I believe that FK constraints work differently from indexes in this
regard.  Not sure that we want to get into that level of detail here.

​Since three of the 4 types are done "after every row" if we want to simplify (I'm leaning toward being precise here) I'd rather be imprecise about the FK.​  Pretending that a FK change is checked sooner than it really is seems like a minor omission since the observed behavior isn't likely to be noticeable.  Wondering why "update pk = pk + 1" doesn't work by default when PK constraints are checked "after every command" has been shown to be noticeable.

David J.

pgsql-bugs by date:

Previous
From: Bruno Richard
Date:
Subject: Re: [BUGS] PostgreSQL hot standby Hangs due to AccessExclusiveLock onpg_attribute or pg_type tables
Next
From: 张明富
Date:
Subject: [BUGS] an error "duplicate key value violates unique constraint ..." happend when update table