Re: [SQL] NOT NULL and postgres 6.5.2 - Mailing list pgsql-sql

From Mark Wright
Subject Re: [SQL] NOT NULL and postgres 6.5.2
Date
Msg-id 001e01bf196f$5c1bc010$c62812ac@markw_compaq
Whole thread Raw
List pgsql-sql
From: Oliver Elphick <olly@lfix.co.uk>
To: Stephan Bauer <stephan_bauer@gmx.de>
Cc: pgsql-sql@postgreSQL.org <pgsql-sql@postgreSQL.org>
Date: Saturday, October 16, 1999 1:58 PM
Subject: Re: [SQL] NOT NULL and postgres 6.5.2


>Stephan Bauer wrote:
>  >Hello all,
>  >
>  >I have an table like this:
>  >
>  >CREATE TABLE anzeigen (
>  >...
>  >
>  >        name                    varchar(30) NOT NULL,
>  >...
>  >);
>  >
>  >The following statement _will_ be inserted:
>  >
>  >INSERT INTO anzeigen ( ... name ...)
>  >VALUES ( ..., '', ...);
>  >
>  >What is my problem?
>
>An empty string is not the same as null.  It is a real value whereas null
>is an unknown/undefined/irrelevant value.


Stephan, I bet you're coming from the Oracle world, where '' is the same as
NULL.

(No lie.  Check this out:
   SQL> create table test_null (id number, name varchar(20) not null);
   Table created.
   SQL> insert into test_null values (1, '');   insert into test_null values (1, '')               *   ERROR at line 1:
 ORA-01400: cannot insert NULL into ("SYSTEM"."TEST_NULL"."NAME")
 

This little bug can be _really_ irritating.

Mark.





pgsql-sql by date:

Previous
From: wieck@debis.com (Jan Wieck)
Date:
Subject: Re: [HACKERS] insertable views - not copy-able ?
Next
From: "Ian L. Atkin"
Date:
Subject: new to postgres!! Perl