Re: [SQL] '' != NULL in PostGres???

From: Brook Milligan <brook(at)trillium(dot)NMSU(dot)Edu>
To: nharkins(at)well(dot)com
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] '' != NULL in PostGres???
Date: 1998-09-23 18:10:47
Message-ID: 199809231810.MAA18985@trillium.nmsu.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

nuacct=> create table users (
nuacct-> recno int,
nuacct-> custid int unique,
nuacct-> username char(14) not null,
nuacct-> service int
nuacct-> );

nuacct=> insert into users values
nuacct-> ( 0, 0, '', 0 );
INSERT 18241 1

??? Shouldn't that have failed, generating an error ???

No, but this will:

nuacct=> insert into users values ( 0, 0, null, 0 );

'' is a zero length string not a null.

Cheers,
Brook

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message David Hartwig 1998-09-23 18:31:43 Re: [SQL] case-insensitive SORT BY?
Previous Message Neil Harkins 1998-09-23 17:41:43 '' != NULL in PostGres???