Re: SET NULL / SET NOT NULL

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема Re: SET NULL / SET NOT NULL
Дата
Msg-id GNELIHDDFBOCMGBFGEFOGENJCBAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответ на Re: SET NULL / SET NOT NULL  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: SET NULL / SET NOT NULL  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Список pgsql-hackers
> OK, how about:
>
>     SET CONSTRAINT NOT NULL
>
> or
>
>     DROP CONSTRAINT NOT NULL
>
> or simply:
>
>     SET/DROP NOT NULL
>
> I think the problem with trying to get it look like CREATE TABLE is that
> the plain NULL parameter to CREATE TABLE is meaningless and probably
> should never be used.  I remember at one point pg_dump output NULL in
> the schema output and it confused many people. NOT NULL is the
> constraint, and I think any solution to remove NOT NULL has to include
> the NOT NULL keyword.  I think this is also why SET NULL looks so bad.
> "CREATE TABLE test (x int NULL)" doesn't look great either.  :-)  What
> is that NULL doing there?

OK, I've decided to go with:

ALTER TABLE blah ALTER [COLUMN] col SET NOT NULL;

and

ALTER TABLE blah ALTER [COLUMN] col DROP NOT NULL;

This is synchronous with the SET/DROP default stuff and is extensible in the
future to fit in with column type changing.

Of course, it can always be changed in the parser without affecting my code.

Chris



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Thomas Lockhart
Дата:
Сообщение: Re: Configuring for 64-bit integer date/time storage?
Следующее
От: Ulrich Neumann
Дата:
Сообщение: Antw: Re: patch for include/utils/datetime.h to target NetWare