From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | j-lists <jamisonlists(at)gmail(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Foreign key verification trigger conditions |
Date: | 2009-06-01 14:20:17 |
Message-ID: | 16841.1243866017@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
j-lists <jamisonlists(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-06-01 14:27:03 | Re: pg_dump & table space |
Previous Message | Richard Huxton | 2009-06-01 14:03:34 | Re: ruby connect |