Re: Behaviour adding a column with and without a default (prior to PG11)

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Behaviour adding a column with and without a default (prior to PG11)
Дата
Msg-id 27688.1569878350@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Behaviour adding a column with and without a default (prior to PG11)  (Joe Horsnell <Joe@bambooloans.com>)
Ответы Re: Behaviour adding a column with and without a default (prior toPG11)  (Joe Horsnell <Joe@bambooloans.com>)
Re: Behaviour adding a column with and without a default (prior toPG11)  (Joe Horsnell <Joe@bambooloans.com>)
Список pgsql-general
Joe Horsnell <Joe@bambooloans.com> writes:
> The documentation (https://www.postgresql.org/docs/10/ddl-alter.html) clearly states that adding a column with a
defaultrequires updating all the rows in the table, to store the new column value (this is prior to PG11, obviously). 

> Obviously the desired effect of adding the column default without rewriting all the rows in the table can be achieved
byadding the nullable column first with no default, then changing the default, but out of curiosity; was there a
specifictechnical reason for the behaviour described above, or was it a conscious design choice? 

We read the SQL spec as requiring this behavior.

            regards, tom lane



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

Предыдущее
От: Gerrit Fouche
Дата:
Сообщение: Re: pg_upgrade (Checking for reg* data types)
Следующее
От: Joe Horsnell
Дата:
Сообщение: Re: Behaviour adding a column with and without a default (prior toPG11)