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