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

From Colin Dick
Subject Re: [SQL] '' != NULL in PostGres???
Date
Msg-id Pine.LNX.3.96.980923115515.19576A-100000@ocis.ocis.net
Whole thread Raw
In response to Re: [SQL] '' != NULL in PostGres???  (Brook Milligan <brook@trillium.NMSU.Edu>)
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.

I wonder,
    Would

insert into users (recno, custid, service) values (0, 0, 0);

also fail?  As far as I can tell, if you don't expressly populate the
field, it will remain as a null....

--
Colin Dick
On Call Internet Services
cdick@mail.ocis.net




pgsql-sql by date:

Previous
From: David Hartwig
Date:
Subject: Re: [SQL] case-insensitive SORT BY?
Next
From: lynch@lscorp.com (Richard Lynch)
Date:
Subject: Re: [SQL] Cursors