BUG #15579: Adding a column with default from configuration parameterfails on 11.1 - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #15579: Adding a column with default from configuration parameterfails on 11.1
Date
Msg-id 15579-c1494c68abb011ec@postgresql.org
Whole thread Raw
Responses Re: BUG #15579: Adding a column with default from configurationparameter fails on 11.1  (Dmitry Dolgov <9erthalion6@gmail.com>)
Re: BUG #15579: Adding a column with default from configuration parameter fails on 11.1  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: BUG #15579: Adding a column with default from configuration parameter fails on 11.1  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      15579
Logged by:          Fredrik Widlert
Email address:      fredrik.widlert@digpro.se
PostgreSQL version: 11.1
Operating system:   Ubuntu 18.04.1 LTS
Description:

We use  configuration parameters as default values in some tables,
like this:

create table t (x int, str varchar(50) default
current_setting('public.some_setting'));

This works in version 11.1 as well as in earlier versions, since we
call set_config before inserting data into the table.

However, 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');

On 11.1 (Ubuntu 11.1-1.pgdg18.04+1 on x86_64-pc-linux-gnu), this fails
with
ERROR:  unrecognized configuration parameter "public.some_setting"
unless we have called set_config in the session trying to add the column.

We expect to only have to call set_config in the session trying
to insert data into the table.

Is this a bug or pehaps an intended change? We tried googling but
didn't find anything which seemed relevant.


pgsql-bugs by date:

Previous
From: Bartosz Polnik
Date:
Subject: Re: BUG #15577: Query returns different results when executedmultiple times
Next
From: Thomas Munro
Date:
Subject: Re: BUG #15577: Query returns different results when executedmultiple times