Re: Is this logical?

From: "Behrang Saeedzadeh" <behrangsa(at)gmail(dot)com>
To: "Stephan Szabo" <sszabo(at)megazone(dot)bigpanda(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Is this logical?
Date: 2006-09-09 22:26:37
Message-ID: 2991d56c0609091526s4643d67asa0001decc4c94bad@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Stephan,

But "not null" is in contradiction with "default null" so the create
statement should not proceed successfuly IMHO.

Regards,
Behi

On 9/10/06, Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com> wrote:
> On Sun, 10 Sep 2006, Behrang Saeedzadeh wrote:
>
> > Shouldn't this create statement trigger an error?
> >
> > create table bar (col1 int not null default null);
> >
> > Shouldn't I be forbidden to insert null values into a non null column?
>
> I think it should forbid it when the default actually comes into play like
> on insert or update, but not at create table time as there are no rows for
> which the constraint fails.
>
> For example after that:
> sszabo=# insert into bar default values;
> ERROR: null value in column "col1" violates not-null constraint
>

--
"We can only see a short distance ahead,
but we can see plenty there
that needs to be done." - Alan Turing

"Science is a differential equation. Religion
is a boundary condition" - Alan Turing

Behrang Saeedzadeh
http://www.jroller.com/page/behrangsa
http://my.opera.com/behrangsa

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Dave Cramer 2006-09-09 22:36:18 Re: Idle in transaction state.
Previous Message Behrang Saeedzadeh 2006-09-09 22:26:24 Re: Is this logical?