pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: fredrik.widlert@digpro.se
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15579: Adding a column with default from configuration parameter fails on 11.1
Date: Mon, 7 Jan 2019 16:22:31 -0500
Message-ID: <80c8c7e4-8756-d206-bdd4-c1e69e4f9d4a@dunslane.net> (raw)
In-Reply-To: <20190107211120.6dztmhvm3hmmee4z@alap3.anarazel.de>
References: <15579-c1494c68abb011ec@postgresql.org>
	<3336.1546873079@sss.pgh.pa.us>
	<9c74611f-b373-3269-04b0-0803a217e1f1@dunslane.net>
	<4403.1546894903@sss.pgh.pa.us>
	<20190107211120.6dztmhvm3hmmee4z@alap3.anarazel.de>


On 1/7/19 4:11 PM, Andres Freund wrote:
> On 2019-01-07 16:01:43 -0500, Tom Lane wrote:
>> Andrew Dunstan <andrew@dunslane.net> writes:
>>> Stable expressions are quite ok for fast defaults. The expression is
>>> evaluated once when the ALTER TABLE is done and the result (not the
>>> expression) is stored in the catalog. The reason we check for volatile
>>> expressions is precisely because we don't want all the existing rows to
>>> get a single value in that case. This was discussed during the Postgres
>>> 11 development cycle.
>> Hmm.
>>
>> The issue here is that if the table is empty, the old behavior evaluated
>> the expression zero times during ALTER TABLE.  Now we evaluate it once,
>> and if that throws an error, that's a user-visible behavior change.
>>
>> Perhaps it's okay to decide that that's an acceptable behavioral change,
>> but it makes this feature less transparent than it was supposed to be.



That's true. But only slightly less transparent, I'd suggest :-)



> It doesn't seem too hard to scan far enough to see whether there's a
> single non-dead row. So we could fix this, if we wanted.
>
> But I'm disinclined to think that it's worth doing so - and there could
> be drawbacks, e.gg tables that are all-dead.  Given the IMO quite minor
> behaviour change, I'm thus disinclined to "fix" this..
>

agreed. It might be worth a doc note?


cheers


andrew





view thread (8+ messages)

Message-ID: <80c8c7e4-8756-d206-bdd4-c1e69e4f9d4a@dunslane.net>
Permalink:  ../80c8c7e4-8756-d206-bdd4-c1e69e4f9d4a@dunslane.net/
Also on:    postgresql.org/message-id/80c8c7e4-8756-d206-bdd4-c1e69e4f9d4a@dunslane.net

 · 

reply

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: andrew@dunslane.net, andres@anarazel.de, tgl@sss.pgh.pa.us, fredrik.widlert@digpro.se
  Subject: Re: BUG #15579: Adding a column with default from configuration parameter fails on 11.1
  In-Reply-To: <80c8c7e4-8756-d206-bdd4-c1e69e4f9d4a@dunslane.net>
  References: <15579-c1494c68abb011ec@postgresql.org> <3336.1546873079@sss.pgh.pa.us> <9c74611f-b373-3269-04b0-0803a217e1f1@dunslane.net> <4403.1546894903@sss.pgh.pa.us> <20190107211120.6dztmhvm3hmmee4z@alap3.anarazel.de> <80c8c7e4-8756-d206-bdd4-c1e69e4f9d4a@dunslane.net>

* 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