Re: Can't ri_KeysEqual() consider two nulls as equal?

From: Richard Huxton <dev(at)archonet(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Can't ri_KeysEqual() consider two nulls as equal?
Date: 2007-04-18 08:11:57
Message-ID: 4625D2CD.1030200@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Simon Riggs wrote:
> On Tue, 2007-04-17 at 17:16 -0400, Tom Lane wrote:
>> A recent discussion led me to the idea that FK triggers are fired
>> unnecessarily during an UPDATE if the foreign-key column(s) contain
>> any NULLs, because ri_KeysEqual() treats two nulls as unequal,
>> and therefore we conclude the row has changed when it has not.
>
> FK trigger *can be optimised away* is true. No need to have a discussion
> about whether NULL == NULL, but the critical test is: if I overwrote it,
> would you be able to tell? The answer is No, so away it goes.

The test should perhaps be named "unchanged" rather than "equal".

--
Richard Huxton
Archonet Ltd

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message sharath kumar 2007-04-18 09:19:19 Re: schema creation during initdb
Previous Message Russell Smith 2007-04-18 07:41:26 Re: Grantor name gets lost when grantor role dropped