Re: NULLs ;-)

From: Ragnar <gnari(at)hive(dot)is>
To: Scott Ribe <scott_ribe(at)killerbytes(dot)com>
Cc: "John D(dot) Burger" <john(at)mitre(dot)org>, pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: NULLs ;-)
Date: 2006-11-28 21:38:59
Message-ID: 1164749939.27070.190.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On þri, 2006-11-28 at 12:28 -0700, Scott Ribe wrote:
> >>> where a <> b or (a is null and b is not null) or (a is not null and
> >>> b is null)
> >>
> >> In the absence of IS DISTINCT FROM, I think this has the same semantics:
> >>
> >> where coalesce(a, b) <> coalesce(b, a)
> >
> > sorry, but no.
>
> So it would have to be where coalesce(a, b, 0) <> coalesce(b, a, 0) for your
> example with ints, and likewise some default value for other column types...

no cigar.

test=# select a,b,
coalesce(a, b, 0) <> coalesce(b, a, 0) as john,
a IS DISTINCT FROM b as dist
from logic;
a | b | john | dist
---+---+------+------
| | f | f
| 1 | f | t
1 | | f | t
1 | 1 | f | f
(4 rows)

gnari

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2006-11-28 21:45:08 Re: slow inet within cidr query
Previous Message novnov 2006-11-28 21:37:44 Re: Editing contrib modules which are loaded by default?