Re: [SQL] NOT NULL and postgres 6.5.2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephan Bauer <stephan_bauer(at)gmx(dot)de>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] NOT NULL and postgres 6.5.2
Date: 1999-10-17 15:58:00
Message-ID: 12783.940175880@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephan Bauer <stephan_bauer(at)gmx(dot)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

Browse pgsql-sql by date

  From Date Subject
Next Message Daniel Péder 1999-10-17 20:56:45 insertable views - not copy-able ?
Previous Message Oliver Elphick 1999-10-16 18:48:26 Re: [SQL] NOT NULL and postgres 6.5.2