Re: Null comparisons (was Re: checksum)

From: David Helgason <david(at)uti(dot)is>
To: "Dean Gibson (DB Administrator)" <postgresql3(at)ultimeth(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Null comparisons (was Re: checksum)
Date: 2004-09-27 21:05:59
Message-ID: 084775E5-10C9-11D9-A1C4-000A9566DA8A@uti.is
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 27. sep 2004, at 22:08, Dean Gibson (DB Administrator) wrote:
> Greg Stark wrote on 2004-09-27 08:17:
>> Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> writes:
>> >> On Sun, 26 Sep 2004 20:16:52 +0200, David Helgason <david(at)uti(dot)is>
>> wrote:
>> >>> On a similar note, I've found myself wanting an extended '='
>> operator
>> >>> meaning
>> >>> (a = b or (a is null and b is null))
>> >
>> > The original does appear to be equivalent to "not(a is distinct
>> from b)",
>> > although I'm not sure that's necessarily easier to use than the
>> above.
>>
>> I often do things like "coalesce(a,0) = coalesce(b,0)".
>> (Or whatever value you know won't appear)
>>
> Even simpler: COALESCE( a = b, a IS NULL AND b IS NULL )

I'm not quite sure what is being accomplished here... My original
expression wasn't that bad, just clunky. I'd prefer a === b or (a
samevalue b), but the above just complicates matters. Also, a 'set'
command outside the expression goes completely against the idea, that
certain fields have 'null' as a legal, comparable value, while others
do not.

Anyway, idle speculation :)

d.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John Liu 2004-09-27 21:18:41 Re: core dump on select
Previous Message Dean Gibson (DB Administrator) 2004-09-27 20:08:34 Re: Null comparisons (was Re: checksum)