Re: [SQL] NOT NULL and postgres 6.5.2

Поиск
Список
Период
Сортировка
Искать

Re: [SQL] NOT NULL and postgres 6.5.2

От:
"Mark Wright" <mwright@pro-ns.net>
Дата:
From: Oliver Elphick 
To: Stephan Bauer 
Cc: 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.




FAQ