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

From Tom Lane
Subject Re: [SQL] NOT NULL and postgres 6.5.2
Date
Msg-id 12783.940175880@sss.pgh.pa.us
Whole thread Raw
In response to NOT NULL and postgres 6.5.2  (Stephan Bauer <stephan_bauer@gmx.de>)
List pgsql-sql
Stephan Bauer <stephan_bauer@gmx.de> writes:
> 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 quite different from a NULL.

If you want to forbid empty strings you could add a constraint
expression, eg, CHECK (name <> '').
        regards, tom lane


pgsql-sql by date:

Previous
From: "Oliver Elphick"
Date:
Subject: Re: [SQL] NOT NULL and postgres 6.5.2
Next
From: Daniel Péder
Date:
Subject: insertable views - not copy-able ?