pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: Ajit Aranha <ajit_aranha@rocketmail.com>
To: pgsql-sql@postgresql.org
Subject: Re: Null not equal to '' (empty)
Date: Fri, 27 Sep 2002 13:36:03 +0100
Message-ID: <200209271336.03193.dev@archonet.com> (raw)
In-Reply-To: <20020920060916.42881.qmail@web14104.mail.yahoo.com>
References: <20020920060916.42881.qmail@web14104.mail.yahoo.com>

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



view thread (4+ messages)  latest in thread

Message-ID: <200209271336.03193.dev@archonet.com>
Permalink:  ../200209271336.03193.dev@archonet.com/
Also on:    postgresql.org/message-id/200209271336.03193.dev@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, ajit_aranha@rocketmail.com
  Subject: Re: Null not equal to '' (empty)
  In-Reply-To: <200209271336.03193.dev@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox