Skip site navigation (1) Skip section navigation (2)

Re: Null comparisons (was Re: checksum)

From: Greg Stark <gsstark(at)mit(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Null comparisons (was Re: checksum)
Date: 2004-09-27 15:17:38
Message-ID: 87y8iv7ncd.fsf@stark.xeocode.com (view raw or flat)
Thread:
Lists: pgsql-general
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)

Though for pretty small values of "often". It always makes me think twice
about my data model when I find myself doing this. But there are definitely
still cases where it's useful and as clean as anything else I could think of.

-- 
greg


In response to

Responses

pgsql-general by date

Next:From: Hagen HoepfnerDate: 2004-09-27 15:33:47
Subject: limiting execution time of queries
Previous:From: Stephan SzaboDate: 2004-09-27 14:47:37
Subject: Null comparisons (was Re: checksum)

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group