How NULL is interpreted in Pgsql

From: Guru Prasad <pnguruji(at)yahoo(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: How NULL is interpreted in Pgsql
Date: 2001-05-15 08:08:17
Message-ID: Pine.LNX.4.20.0105151323560.16374-100000@Larry.bks
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 | bolt
1002.000000 | nut
1003.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
-------------------------------------------------------------------------------

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message 山さん 2001-05-15 08:40:32 Give me a suggestion 'START WITH .. CONNECT BY'.
Previous Message Michael Davis 2001-05-15 01:33:06 RE: Auto incrementing an integer