Re: Re: Does PostgreSQL support EXISTS?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: Re: Does PostgreSQL support EXISTS?
Date: 2001-06-13 15:09:09
Message-ID: 200106131509.f5DF99V08176@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I thought NOT IN was the only one that was concerned about any NULL?
>
> No, they both are: in the presence of NULLs, IN can return TRUE or NULL,
> NOT IN can return FALSE or NULL.
>
> The reason the FAQ is always about NOT NULL is that WHERE treats NULL as
> FALSE, so the average newbie writing an IN doesn't even realize he's
> getting a NULL rather than a FALSE. With NOT NULL, he can't ignore it.

Got it. How does an IN subquery returning NULL behave differently from
one returning FALSE? I can't think of a test that would be affected.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Thalis A. Kalfigopoulos 2001-06-13 15:15:24 Re: Unique rows without a key
Previous Message Tom Lane 2001-06-13 15:02:38 Re: Re: Does PostgreSQL support EXISTS?