BUG #15579: Adding a column with default from configuration parameter fails on 11.1

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: fredrik(dot)widlert(at)digpro(dot)se
Subject: BUG #15579: Adding a column with default from configuration parameter fails on 11.1
Date: 2019-01-07 12:14:17
Message-ID: 15579-c1494c68abb011ec@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15579
Logged by: Fredrik Widlert
Email address: fredrik(dot)widlert(at)digpro(dot)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.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Munro 2019-01-07 12:19:32 Re: BUG #15577: Query returns different results when executed multiple times
Previous Message Bartosz Polnik 2019-01-07 09:17:47 Re: BUG #15577: Query returns different results when executed multiple times