From: Tom Lane <tgl@sss.pgh.pa.us>
To: fredrik.widlert@digpro.se
Cc: pgsql-bugs@lists.postgresql.org, Andrew Dunstan <andrew@dunslane.net>
Subject: Re: BUG #15579: Adding a column with default from configuration parameter fails on 11.1
Date: Mon, 07 Jan 2019 09:57:59 -0500
Message-ID: <3336.1546873079@sss.pgh.pa.us> (raw)
In-Reply-To: <15579-c1494c68abb011ec@postgresql.org>
References: <15579-c1494c68abb011ec@postgresql.org>
=?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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, fredrik.widlert@digpro.se, andrew@dunslane.net
Subject: Re: BUG #15579: Adding a column with default from configuration parameter fails on 11.1
In-Reply-To: <3336.1546873079@sss.pgh.pa.us>
References: <15579-c1494c68abb011ec@postgresql.org> <3336.1546873079@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox