From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix handling of GENERATED columns in CREATE TABLE LIKE INCLUDING
Date: Wed, 25 Sep 2019 21:30:58 +0000
Message-ID: <E1iDEsE-0000py-GB@gemulon.postgresql.org> (raw)
Fix handling of GENERATED columns in CREATE TABLE LIKE INCLUDING DEFAULTS.
LIKE INCLUDING DEFAULTS tried to copy the attrdef expression without
copying the state of the attgenerated column. This is in fact wrong,
because GENERATED and DEFAULT expressions are not the same kind of animal;
one can contain Vars and the other not. We *must* copy attgenerated
when we're copying the attrdef expression. Rearrange the if-tests
so that the expression is copied only when the correct one of
INCLUDING DEFAULTS and INCLUDING GENERATED has been specified.
Per private report from Manuel Rigger.
Tom Lane and Peter Eisentraut
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/b81a9c2fc52509025c635fa08ecaec1bad21441b
Modified Files
--------------
src/backend/parser/parse_utilcmd.c | 12 ++--
src/test/regress/expected/create_table_like.out | 74 +++++++++++++++++++++++++
src/test/regress/sql/create_table_like.sql | 20 +++++++
3 files changed, 100 insertions(+), 6 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 CREATE TABLE LIKE INCLUDING
In-Reply-To: <E1iDEsE-0000py-GB@gemulon.postgresql.org>
References: <E1iDEsE-0000py-GB@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