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

From: Colin Dick <cdick(at)mail(dot)ocis(dot)net>
To: Brook Milligan <brook(at)trillium(dot)NMSU(dot)Edu>
Cc: nharkins(at)well(dot)com, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] '' != NULL in PostGres???
Date: 1998-09-23 18:57:35
Message-ID: Pine.LNX.3.96.980923115515.19576A-100000@ocis.ocis.net
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.

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(at)mail(dot)ocis(dot)net

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Richard Lynch 1998-09-23 20:09:15 Re: [SQL] Cursors
Previous Message David Hartwig 1998-09-23 18:31:43 Re: [SQL] case-insensitive SORT BY?