Re: SET NULL / SET NOT NULL - Mailing list pgsql-hackers

From Philip Warner
Subject Re: SET NULL / SET NOT NULL
Date
Msg-id 3.0.5.32.20020221141819.0361a5b0@mail.rhyme.com.au
Whole thread Raw
In response to Re: SET NULL / SET NOT NULL  (Thomas Lockhart <lockhart@fourpalms.org>)
List pgsql-hackers
At 18:34 20/02/02 -0800, Thomas Lockhart wrote:
>> >  ALTER TABLE blah ALTER COLUMN col [ALLOW NULL | NOT NULL]
>> FWIW, I like this syntax too.
>
>What would be the drawbacks to having all portions after "col" in the
>example above be *exactly* the same as the clauses allowed in CREATE
>TABLE? So, this would be
>
>  ALTER TABLE tab ALTER COLUMN col [ NULL | NOT NULL ]

This looks fine to me. The spec only talks about CHECK constraints in ALTER
TABLE, but if I had to guess the most spec-like syntax, it would be:
 ALTER TABLE tab ALTER COLUMN col DROP NOT NULL

which does not seem particularly good; preserving the syntax from table
creation has to be TWTG. Do we really allow:
CREATE TABLE FOO(BAR INT NULL)

?


>In that same line of thought, how about making it more closely mimic the
>original CREATE TABLE syntax? Something like

Because the SQL spec does have ALTER TABLE...ALTER COLUMN; so we should
stick with the same syntax.


>Hmm. Or if we are going to eventually allow altering column types then
>one could include the type also.

Definitely; Chris' suggestion seems pretty good to me.


----------------------------------------------------------------
Philip Warner                    |     __---_____
Albatross Consulting Pty. Ltd.   |----/       -  \
(A.B.N. 75 008 659 498)          |          /(@)   ______---_
Tel: (+61) 0500 83 82 81         |                 _________  \
Fax: (+61) 0500 83 82 82         |                 ___________ |
Http://www.rhyme.com.au          |                /           \|                                |    --________--
PGP key available upon request,  |  /
and from pgp5.ai.mit.edu:11371   |/


pgsql-hackers by date:

Previous
From: Thomas Lockhart
Date:
Subject: Re: SET NULL / SET NOT NULL
Next
From: Philip Warner
Date:
Subject: Re: SET NULL / SET NOT NULL