Re: Null not equal to '' (empty)

From: Richard Huxton <dev(at)archonet(dot)com>
To: Ajit Aranha <ajit_aranha(at)rocketmail(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: Null not equal to '' (empty)
Date: 2002-09-27 12:36:03
Message-ID: 200209271336.03193.dev@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Ries van Twisk 2002-09-27 12:40:06 Re: Null not equal to '' (empty)
Previous Message Andreas Joseph Krogh 2002-09-27 11:42:53 7.3 schemas