Re: Foreign key verification trigger conditions - Mailing list pgsql-general

From Tom Lane
Subject Re: Foreign key verification trigger conditions
Date
Msg-id 16841.1243866017@sss.pgh.pa.us
Whole thread Raw
In response to Foreign key verification trigger conditions  (j-lists <jamisonlists@gmail.com>)
Responses Re: Foreign key verification trigger conditions
List pgsql-general
j-lists <jamisonlists@gmail.com> writes:
> I have an update statement that affects every row in a given table.
> For that table it changes the value in a single column, which itself
> has a foreign key constraint. The table has an additional 9 foreign
> keys, some of which reference large tables.
> My expectation would be that only the changed column would be checked
> against the foreign key of interest, instead I find that all the
> foreign keys are checked when this statement is executed.

What your test case actually seems to show is that the skip-the-trigger
optimization doesn't fire when the column value is NULL.  Which is
because ri_KeysEqual() doesn't consider two nulls to be equal.  It's
possible we could change that but I'd be worried about breaking other
cases that are actually semantically critical...

            regards, tom lane

pgsql-general by date:

Previous
From: Richard Huxton
Date:
Subject: Re: ruby connect
Next
From: Tom Lane
Date:
Subject: Re: pg_dump & table space