Re: Using NOT IN

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Juan Francisco Diaz <j-diaz(at)publicar(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Using NOT IN
Date: 2003-09-04 03:22:50
Message-ID: 6915.1062645770@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Juan Francisco Diaz <j-diaz(at)publicar(dot)com> writes:
> When i need it executed, the subquery returns 0 rows, maybe th if condition
> is false because the not in operator does not 'work' if there are 0 rows...

More likely, you have some null values in the sub-select. NOT IN has
fairly unintuitive behavior in the presence of nulls. See the manual.

regards, tom lane

In response to

  • Using NOT IN at 2003-09-03 22:02:01 from Juan Francisco Diaz

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2003-09-04 03:47:37 Re: Errors on restoring a 7.1.2 dump to 7.3.3
Previous Message Bruno Wolff III 2003-09-04 03:19:32 Re: order by, but eliminating dupes