Search Postgresql Archives

IN query operator and NULL values

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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=# insert into test values(3,null);
INSERT 6838417 1
test=# select * from test ;
a | b
---+---
1 | 1
2 | 2
3 |
(3 rows)

test=# select * from test where b in(1,null);
a | b
---+---
1 | 1

In the last resultset, i was expecting two records the one with b = 1 and the one with b = null.
PostgreSQL instead returns only the value with not null values.

I tested the example also in PostgreSQL 8.1 and it works correctly (two records).

So the question is: what has changed from 8.1 to 8.2?

Thank you in advance for your help,

Denis


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux