Re: Null not equal to '' (empty) - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Null not equal to '' (empty)
Date
Msg-id 200209271336.03193.dev@archonet.com
Whole thread Raw
In response to Null not equal to '' (empty)  (Ajit Aranha <ajit_aranha@rocketmail.com>)
List pgsql-sql
On Friday 20 Sep 2002 7:09 am, Ajit Aranha wrote:
>  Why is ''(empty) not equal to null? Its a major headache when porting
> from other RDBMS like Oracle. Anyone knows any easy workarounds?

By definition it is different - null means "not known" or "no value" not empty
string. Do you think it should be zero for numbers?

> i.e. if you use:    create table tbl (
>                          c1 varchar(5));
>          insert into tbl values ('');
>                       select * from tbl where c1 is null;  will return
> zero rows.

Yep - that's the way it should be. If you want empty-strings, ask for them. If
you don't want to allow null values in a column define it as NOT NULL.

- Richard Huxton


pgsql-sql by date:

Previous
From: "Ries van Twisk"
Date:
Subject: Re: Null not equal to '' (empty)
Next
From: Richard Huxton
Date:
Subject: Re: Dublicates pairs in a table.