Re: SET NULL / SET NOT NULL
От | Peter Eisentraut |
---|---|
Тема | Re: SET NULL / SET NOT NULL |
Дата | |
Msg-id | Pine.LNX.4.30.0202212012540.683-100000@peter.localdomain обсуждение исходный текст |
Ответ на | Re: SET NULL / SET NOT NULL ("Christopher Kings-Lynne" <chriskl@familyhealth.com.au>) |
Ответы |
Re: SET NULL / SET NOT NULL
Re: SET NULL / SET NOT NULL |
Список | pgsql-hackers |
Christopher Kings-Lynne writes: > 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'; This is standard. > ALTER TABLE blah ALTER COLUMN col NULL; > ALTER TABLE blah ALTER COLUMN col NOT NULL; This is missing a verb. It can be read as "alter table blah, in particular, alter column col, (and do what with?) NULL". Is the NULL part of the identity of the column? Using the standard precedent above, how about ALTER TABLE blah ALTER COLUMN col SET NOT NULL; ALTER TABLE blah ALTER COLUMN col DROP NOT NULL; This also avoids the confusing "NULL constraint", which does not say that the column has to be NULL. > ALTER TABLE blah ALTER COLUMN col varchar(50); Here again, there should probably be at least one more word inserted, like TYPE. > 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'; Maybe ... ALTER COLUMN col TO text ... > Is this the eventual goal? Will this cause shift/reduce errors? will we > need to put the word 'SET' in after 'col'? A shift/reduce conflict has never stopped us. ;-) -- Peter Eisentraut peter_e@gmx.net
В списке pgsql-hackers по дате отправления: