[GENERAL] IN query operator and NULL values

2008-05-16 Thread Denis Gasparin
Hi all. I have a problem with the IN operator in PostgreSQL 8.2.7. Here it is an example that reproduce the problem: test=# create table test(a integer ,b integer); CREATE TABLE test=# insert into test values(1,1); INSERT 6838415 1 test=# insert into test values(2,2); INSERT 6838416 1 test=#

Re: [GENERAL] IN query operator and NULL values

2008-05-16 Thread Alban Hertroys
On May 16, 2008, at 5:40 PM, Denis Gasparin wrote: Hi all. I have a problem with the IN operator in PostgreSQL 8.2.7. Here it is an example that reproduce the problem: test=# select * from test where b in(1,null); a | b ---+--- 1 | 1 In the last resultset, i was expecting two records the

Re: [GENERAL] IN query operator and NULL values

2008-05-16 Thread Alban Hertroys
On May 16, 2008, at 6:54 PM, Alban Hertroys wrote: development= select b, coalesce( (b in (1, null))::text, 'NULL') from test; b | coalesce ---+-- 1 | true 2 | NULL | NULL (3 rows) Just remembered a nice option from psql that doesn't quite clutter my example as much:

Re: [GENERAL] IN query operator and NULL values

2008-05-16 Thread Andy Anderson
The non-compliance fix is described here: http://www.postgresql.org/docs/8.3/interactive/functions- comparison.html says: To check whether a value is or is not null, use the constructs expression IS NULL expression IS NOT NULL or the equivalent, but nonstandard, constructs Note: If