pgsql: Fix handling of GENERATED columns in CREATE TABLE LIKE INCLUDING - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix handling of GENERATED columns in CREATE TABLE LIKE INCLUDING
Date
Msg-id E1iDEsE-0000pz-GT@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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
------
REL_12_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/658d391d87c13a4b27425a2fd014f2162956ad4d

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(-)


pgsql-committers by date:

Previous
From: Alexander Korotkov
Date:
Subject: Re: pgsql: Implement jsonpath .datetime() method
Next
From: Alexander Korotkov
Date:
Subject: Re: pgsql: Implement jsonpath .datetime() method