Re: SET NULL / SET NOT NULL

Поиск
Список
Период
Сортировка
От Philip Warner
Тема Re: SET NULL / SET NOT NULL
Дата
Msg-id 3.0.5.32.20020221141819.0361a5b0@mail.rhyme.com.au
обсуждение исходный текст
Ответ на Re: SET NULL / SET NOT NULL  (Thomas Lockhart <lockhart@fourpalms.org>)
Список 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 по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: SET NULL / SET NOT NULL
Следующее
От: Philip Warner
Дата:
Сообщение: Re: SET NULL / SET NOT NULL