Re: BUG #15579: Adding a column with default from configuration parameter fails on 11.1
От | Tom Lane |
---|---|
Тема | Re: BUG #15579: Adding a column with default from configuration parameter fails on 11.1 |
Дата | |
Msg-id | 3336.1546873079@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #15579: Adding a column with default from configuration parameterfails on 11.1 (PG Bug reporting form <noreply@postgresql.org>) |
Ответы |
Re: BUG #15579: Adding a column with default from configurationparameter fails on 11.1
|
Список | pgsql-bugs |
=?utf-8?q?PG_Bug_reporting_form?= <noreply@postgresql.org> writes: > ... creating the table first and then adding the column does not > work on 11.1. It used to work at least from version 9.3 to 10. > create table t (x int); > alter table t add c varchar(50) default > current_setting('public.some_setting'); > ERROR: unrecognized configuration parameter "public.some_setting" I think this is a brown-paper-bag bug in the fast-column-default feature. current_setting() is stable, and should certainly not be treated as a fast default, but behold the test looks like this: /* If the DEFAULT is volatile we cannot use a missing value */ if (colDef->missingMode && contain_volatile_functions((Node *) expr)) colDef->missingMode = false; Of course, it should be insisting that the expression be immutable, not just that it not be volatile. - /* If the DEFAULT is volatile we cannot use a missing value */ - if (colDef->missingMode && contain_volatile_functions((Node *) expr)) + /* missingMode can only be used for immutable defaults */ + if (colDef->missingMode && contain_mutable_functions((Node *) expr)) colDef->missingMode = false; regards, tom lane
В списке pgsql-bugs по дате отправления: