NOT NULL Issue

From: "Gustav Lindenberg" <gustav(dot)lindenberg(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: NOT NULL Issue
Date: 2007-09-10 18:36:01
Message-ID: 2238dbef0709101136l13d91fb8uabee6dab3869c2fc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi

Why is '' not considered null is postgres (8.1.3) Currently I have to
use the following workaround where I have zero length strings in char
fields.

select * from security.users where length(us_username)=0;
Surely this a null. Apparently not in Postgres.

Currently I have to use the following SQL to pick up zero length strings:
alter table security.users add constraint notnull_username
check(us_username <> '');

Thanks
Gustav

Responses

Browse pgsql-general by date

  From Date Subject
Next Message RC Gobeille 2007-09-10 19:00:03 Re: Database reverse engineering
Previous Message Jeff Davis 2007-09-10 18:28:22 Re: audit sql queries