Re: Is this logical?

From: Ron Johnson <ron(dot)l(dot)johnson(at)cox(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Is this logical?
Date: 2006-09-10 01:38:59
Message-ID: 45036CB3.6050902@cox.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Behrang Saeedzadeh wrote:
> Stephan,
>
> But "not null" is in contradiction with "default null" so the create
> statement should not proceed successfuly IMHO.

I see your point, but those are run-time (i.e. DML) operations, not
DDL statements. Added complexity would have to be added to the
parser, and added complexity makes for more bugs.

> 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

- --
Ron Johnson, Jr.
Jefferson LA USA

Is "common sense" really valid?
For example, it is "common sense" to white-power racists that
whites are superior to blacks, and that those with brown skins
are mud people.
However, that "common sense" is obviously wrong.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFA2yzS9HxQb37XmcRAp77AJ4jhCy2kWu89QbG+D/O+3DVRO9q7gCaApXU
HE4hItgv6f0LH2OQEyIVV/A=
=9IQY
-----END PGP SIGNATURE-----

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Christopher Browne 2006-09-10 01:48:23 Re: Data Warehouse
Previous Message Tom Lane 2006-09-10 01:34:56 Re: Is this logical?