Can't use NULL in IN conditional?

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Can't use NULL in IN conditional?
Date: 2000-12-11 07:49:19
Message-ID: 200012110749.eBB7nJv04235@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Charles Tassell (ctassell(at)isn(dot)net) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
Can't use NULL in IN conditional?

Long Description
I don't know if this is a "feature" that comes alogn with NULL values, or somethign I'm doing wrong, but I can't seem to search for the NULL value via a WHERE xx IN clause. I've re-written the query to use OR and it works fine then, but not with the IN clause. This is with Postgres 7.02 on a Linux system (PostgreSQL 7.0.2 on i686-pc-linux-gnu, compiled by gcc egcs-2.91.66)

Sample Code
CREATE TABLE product_types (
type_id serial,
code text
)
INSERT INTO product_types (code) VALUES ('0A');
INSERT INTO product_types (code) VALUES (NULL);
-- This works
SELECT type_id, code FROM product_types WHERE code = '0A' OR code = NULL;
-- This doesn't
SELECT type_id, code FROM product_types WHERE code IN ('OA', NULL);

No file was uploaded with this report

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Kevin Gilpin 2000-12-11 14:51:35 CREATE FUNCTION distributors_id_max() RETURNS INT4 AS Bad Timestamp Format thrown by jdbc7.0-1.2.jar
Previous Message The Hermit Hacker 2000-12-10 17:15:34 Re: Re: [BUGS] 7.1beta1 JDBC Nested cursor problem