How NULL is interpreted in Pgsql - Mailing list pgsql-sql

From Guru Prasad
Subject How NULL is interpreted in Pgsql
Date
Msg-id Pine.LNX.4.20.0105151323560.16374-100000@Larry.bks
Whole thread Raw
Responses Re: How NULL is interpreted in Pgsql
List pgsql-sql
Dear Friends,

I created a table with no 'unique constraints' which is depicted as
follows.

create table junk (id int, name varchar);

Then, i inserted some records into the table. My table contents is listed
below.
    id      | name
-------------+------1001.000000 | bolt1002.000000 | nut1003.000000 |  11.000000 | screw            | cutter
|cutting table
 

Then, i gave a select query for the above table. The select query is

'select * from junk where id != 11';

To my surprise, it displayed all the records except those which had
'NULL' in the 'id' field.

How is that possible ? (I mean it should displayed all the records except
the matching condition). 

But, if i set PRIMARY KEY constraint to 'junk' table then it displays all
the records (I can't say NULL here, but i can say '0'). 

How NULL is processed in Postgres. 
Could any one has some clue.

Regards,
guru.

bk SYSTEMS (P) Ltd.                                                   P . N . G U R U P R A S A D
-------------------------------------------------------------------------------





pgsql-sql by date:

Previous
From: Michael Davis
Date:
Subject: RE: Auto incrementing an integer
Next
From: Justin Clift
Date:
Subject: Re: error message...