Re: Is this logical?

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

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jaime Casanova 2006-09-09 22:18:34 Data Warehouse
Previous Message Ron Johnson 2006-09-09 21:49:19 Re: Is this logical?