Re: SET NULL / SET NOT NULL
От | Christopher Kings-Lynne |
---|---|
Тема | Re: SET NULL / SET NOT NULL |
Дата | |
Msg-id | GNELIHDDFBOCMGBFGEFOGEHPCBAA.chriskl@familyhealth.com.au обсуждение исходный текст |
Ответ на | Re: SET NULL / SET NOT NULL (Doug McNaught <doug@wireboard.com>) |
Ответы |
Re: SET NULL / SET NOT NULL
Re: SET NULL / SET NOT NULL |
Список | pgsql-hackers |
> > I'm not too fond of 'SET NULL' - the syntax implies the column > is being set > > to NULL. But I agree with the rest given we already have ALTER > > TABLE...ALTER COLUMN, I'd vote for: > > > > ALTER TABLE blah ALTER COLUMN col [ALLOW NULL | NOT NULL] > > FWIW, I like this syntax too. Let's say, theoretically, that in the future we want to allow people to change the type of their columns, plus allow them to change the nullability. Should we come up with a syntax for changing nullability that allows for the future changing of column type? If so, then a syntaxes like these might be the way to go: ALTER TABLE blah ALTER COLUMN col DROP DEFAULT; ALTER TABLE blah ALTER COLUMN col SET DEFAULT 't'; ALTER TABLE blah ALTER COLUMN col NULL; ALTER TABLE blah ALTER COLUMN col NOT NULL; ALTER TABLE blah ALTER COLUMN col varchar(50); ALTER TABLE blah ALTER COLUMN col int4 NULL; ALTER TABLE blah ALTER COLUMN col text NOT NULL; If we just allow the full col spec we could one day support this: ALTER TABLE blah ALTER COLUMN col text boolean NOT NULL DEFAULT 'f'; Which would change the column to that definition (if coercion is possible) no matter what current definition is... Is this the eventual goal? Will this cause shift/reduce errors? will we need to put the word 'SET' in after 'col'? Chris
В списке pgsql-hackers по дате отправления: