From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix handling of generated columns in ALTER TABLE.
Date: Wed, 08 Jan 2020 14:43:17 +0000
Message-ID: <E1ipCYH-00012S-VT@gemulon.postgresql.org> (raw)
Fix handling of generated columns in ALTER TABLE.
ALTER TABLE failed if a column referenced in a GENERATED expression
had been added or changed in type earlier in the ALTER command.
That's because the GENERATED expression needs to be evaluated
against the table's updated tuples, but it was being evaluated
against the original tuples. (Fortunately the executor has adequate
cross-checks to notice the mismatch, so we just got an obscure error
message and not anything more dangerous.)
Per report from Andreas Joseph Krogh. Back-patch to v12 where
GENERATED was added.
Discussion: https://postgr.es/m/VisenaEmail.200.231b0a41523275d0.16ea7f800c7@tc7-visena
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/4ac8aaa36fa24639989849c8109f8b52e9544fd1
Modified Files
--------------
src/backend/commands/tablecmds.c | 33 ++++++++++-
src/test/regress/expected/generated.out | 97 ++++++++++++++++++++++++++-------
src/test/regress/sql/generated.sql | 31 +++++++++--
3 files changed, 132 insertions(+), 29 deletions(-)
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-committers@postgresql.org
Cc: tgl@sss.pgh.pa.us
Subject: Re: pgsql: Fix handling of generated columns in ALTER TABLE.
In-Reply-To: <E1ipCYH-00012S-VT@gemulon.postgresql.org>
References: <E1ipCYH-00012S-VT@gemulon.postgresql.org>
* 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