Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
Дата
Msg-id 3036.1396497272@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL  (Amit Langote <amitlangote09@gmail.com>)
Ответы Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
Список pgsql-general
Amit Langote <amitlangote09@gmail.com> writes:
> When I do the following:

> ALTER TABLE table ADD COLUMN numeric(x) DEFAULT NULL;

> The table is rewritten whereas notes section on the manual page for
> ALTER TABLE says otherwise (which holds true for most of the cases
> though).

Try it without the explicit DEFAULT clause.

Some experimentation suggests that we are smart about "DEFAULT NULL"
unless the column type requires a length-coercion cast, in which
case the default expression involves a function call, and that doesn't
get elided.

            regards, tom lane


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

Предыдущее
От: Amit Langote
Дата:
Сообщение: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL
Следующее
От: Amit Langote
Дата:
Сообщение: Re: Table Rewrite During ALTER TABLE ... ADD COLUMN ... DEFAULT NULL