Re: Bug: Deferred FKey Check Happening on Double Update, Not Single - Mailing list pgsql-bugs

From Doug Safreno
Subject Re: Bug: Deferred FKey Check Happening on Double Update, Not Single
Date
Msg-id CAA=+orv3dihLAEp7f49o-kHkiJ6d=yTknjuk0RgLPbrtxYMFdw@mail.gmail.com
Whole thread Raw
In response to Re: Bug: Deferred FKey Check Happening on Double Update, Not Single  (Sergei Kornilov <sk@zsrv.org>)
Responses Re: Bug: Deferred FKey Check Happening on Double Update, Not Single  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-bugs
Hey Sergei,

Neither transaction touches FK fields - so shouldn't they both skip FK trigger check?

Best,
Doug


On Thu, Feb 14, 2019 at 11:42 PM Sergei Kornilov <sk@zsrv.org> wrote:
Hi

> Which one is expected?

Both are expected. This is foreign key check optimisation: we can safely skip FK trigger check if row was inserted not in this transaction and update does not touch FK fields: https://github.com/postgres/postgres/blob/REL_11_STABLE/src/backend/utils/adt/ri_triggers.c#L1769

> And is this really a bug?

so no, this is not bug.

regards, Sergei

pgsql-bugs by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: BUG #15631: Generated as identity field in a temporary table withon commit drop corrupts system catalogs
Next
From: Andrew Gierth
Date:
Subject: Re: Bug: Deferred FKey Check Happening on Double Update, Not Single