Re: [SQL] '' != NULL in PostGres??? - Mailing list pgsql-sql

From Brook Milligan
Subject Re: [SQL] '' != NULL in PostGres???
Date
Msg-id 199809231810.MAA18985@trillium.nmsu.edu
Whole thread Raw
In response to '' != NULL in PostGres???  (Neil Harkins <nharkins@well.com>)
Responses Re: [SQL] '' != NULL in PostGres???  (Colin Dick <cdick@mail.ocis.net>)
List 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

pgsql-sql by date:

Previous
From: Neil Harkins
Date:
Subject: '' != NULL in PostGres???
Next
From: David Hartwig
Date:
Subject: Re: [SQL] case-insensitive SORT BY?