Re: [SQL] NOT NULL and postgres 6.5.2

From: "Mark Wright" <mwright(at)pro-ns(dot)net>
To: <pgsql-sql(at)postgreSQL(dot)org>
Subject: Re: [SQL] NOT NULL and postgres 6.5.2
Date: 1999-10-18 13:47:41
Message-ID: 001e01bf196f$5c1bc010$c62812ac@markw_compaq
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Stephan Bauer <stephan_bauer(at)gmx(dot)de>
Cc: pgsql-sql(at)postgreSQL(dot)org <pgsql-sql(at)postgreSQL(dot)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.

Browse pgsql-sql by date

  From Date Subject
Next Message Ian L. Atkin 1999-10-18 20:26:44 new to postgres!! Perl
Previous Message Jan Wieck 1999-10-18 08:53:00 Re: [HACKERS] insertable views - not copy-able ?