changing the nulability of columns

Поиск
Список
Период
Сортировка
От Christopher Kings-Lynne
Тема changing the nulability of columns
Дата
Msg-id GNELIHDDFBOCMGBFGEFOOEGLCBAA.chriskl@familyhealth.com.au
обсуждение исходный текст
Ответы Re: changing the nulability of columns  ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>)
Re: changing the nulability of columns  ("Matthew T. O'Connor" <matthew@zeut.net>)
Список pgsql-hackers
Hi guys,

This is like the 10th time I've tried to post this!  Every time I send a
mail with SET NULL / SET NOT NULL in the subject - it never appears on the
list - what's going on?????

I've been chatting to Tom about implementing the ability to change the NULL
status of a column via SQL.

This is the Oracle syntax:

alter table table_name modify column1 not null;
alter table table_name modify column1 null;

This is the MySQL syntax:

ALTER TABLE asfd CHANGE [COLUMN] old_col_name create_definition [FIRST |
AFTER column_name]
or    ALTER TABLE asfd MODIFY [COLUMN] create_definition [FIRST | AFTER
column_name]

CHANGE col_name, DROP col_name, and DROP INDEX are MySQL extensions to ANSI
SQL92.
MODIFY is an Oracle extension to ALTER TABLE.

So, the question is - what the heck is the standard syntax?  Is there a
standard syntax?  How about this syntax that I came up with:

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

Anyone have any ideas?  Perhaps we should use some sort of 'MODIFY'-like
syntax to enable in the future maybe the ability to change column specs in
more advanced ways (such as column type and size)

If the answer is no, Postgres's parser does not have this syntax enabled,
then I'm going to have to ask someone to implement it for me, and then I can
fill in the actual guts of the function - whereever that may be.  (I don't
know parser stuff!)

Chris



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Ready to branch 7.2/7.3 ?
Следующее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: changing the nulability of columns