Re: BUG #13501: Bug with subqueries in WHERE clause

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: me(at)egidiocaprino(dot)it
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13501: Bug with subqueries in WHERE clause
Date: 2015-07-15 15:28:20
Message-ID: 5211.1436974100@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

me(at)egidiocaprino(dot)it writes:
> This query returns no record

> select *
> from merge.organization
> where school_id not in (select school_id from merge.account)
> or school_id not in (select school_id from merge.sd3_hierarchy)

This usually means that you've got NULLs in the school_id column.
NOT IN never returns true if there are any nulls in the sub-select result.
This is per SQL standard.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Andrew Gierth 2015-07-15 16:51:03 Re: Grouping Sets: Fix unrecognized node type bug
Previous Message Jeevan Chalke 2015-07-15 13:40:45 Grouping Sets: Fix unrecognized node type bug