Re: Is this logical?

From: Sim Zacks <sim(at)compulab(dot)co(dot)il>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is this logical?
Date: 2006-09-10 07:57:58
Message-ID: ee0d7q$mjq$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

If there is no default statement, then the default (by default) is null.
What you are suggesting is that every field that is not null should
require a default value.

Behrang Saeedzadeh wrote:
> 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
>>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sim Zacks 2006-09-10 08:48:26 Re: trigger speed
Previous Message Chris Hyde 2006-09-10 04:39:02 Re: Data Warehouse