| От | Tom Lane |
|---|---|
| Тема | Re: 7.3.3 ADD COLUMN wierdness |
| Дата | |
| Msg-id | 2815.1055774335@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | 7.3.3 ADD COLUMN wierdness ("Brian O'Donoghue" <bodonoghue@stockbyte.com>) |
| Список | pgsql-bugs |
"Brian O'Donoghue" <bodonoghue@stockbyte.com> writes:
> ALTER TABLE blah ADD COLUMN whatever integer not null;
> Adding NOT NULL columns is not implemented.
> Add the column, then use ALTER TABLE ... SET NOT NULL.
> Hmm, the last time I checked, this should have worked.
Although 7.1 allowed that, it did not work correctly --- the NOT NULL
wasn't checked. 7.3 is aware that it can't handle it :-).
You can do ALTER TABLE ADD COLUMN, then UPDATE to fill all the rows
with a suitable value, then ALTER again to set the NOT NULL constraint.
Yeah, it's a pain, but no one's gotten around to writing the code that
would be needed to handle doing this in one step.
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера