pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue 2+ messages / 1 participants [nested] [flat]
* pgsql: Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue @ 2020-04-09 14:42 Peter Eisentraut <peter@eisentraut.org> 0 siblings, 0 replies; 2+ messages in thread From: Peter Eisentraut @ 2020-04-09 14:42 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue CREATE TABLE LIKE INCLUDING GENERATED would fail if a generated column referred to a column with a higher attribute number. This is because the column mapping mechanism created the mapping incrementally as columns are added. This was sufficient for previous uses of that mechanism (omitting dropped columns), and it also happened to work if generated columns only referred to columns with lower attribute numbers, but here it failed. This fix is to build the attribute mapping in a separate loop before processing the columns in detail. Bug: #16342 Reported-by: Ethan Waldo <ewaldo@healthetechs.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/e92e4a2b68fe877677278c1300db1780956c984e Modified Files -------------- src/backend/parser/parse_utilcmd.c | 25 ++++++++++++++++++--- src/test/regress/expected/create_table_like.out | 29 +++++++++++++------------ src/test/regress/sql/create_table_like.sql | 19 ++++++++-------- 3 files changed, 47 insertions(+), 26 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
* pgsql: Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue @ 2020-04-09 14:42 Peter Eisentraut <peter@eisentraut.org> 0 siblings, 0 replies; 2+ messages in thread From: Peter Eisentraut @ 2020-04-09 14:42 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue CREATE TABLE LIKE INCLUDING GENERATED would fail if a generated column referred to a column with a higher attribute number. This is because the column mapping mechanism created the mapping incrementally as columns are added. This was sufficient for previous uses of that mechanism (omitting dropped columns), and it also happened to work if generated columns only referred to columns with lower attribute numbers, but here it failed. This fix is to build the attribute mapping in a separate loop before processing the columns in detail. Bug: #16342 Reported-by: Ethan Waldo <ewaldo@healthetechs.com> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/f06d583c5ad7a6a129d846103225448861f2df0d Modified Files -------------- src/backend/parser/parse_utilcmd.c | 25 ++++++++++++++++++--- src/test/regress/expected/create_table_like.out | 29 +++++++++++++------------ src/test/regress/sql/create_table_like.sql | 19 ++++++++-------- 3 files changed, 47 insertions(+), 26 deletions(-) ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-04-09 14:42 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-04-09 14:42 pgsql: Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue Peter Eisentraut <peter@eisentraut.org> 2020-04-09 14:42 pgsql: Fix CREATE TABLE LIKE INCLUDING GENERATED column order issue Peter Eisentraut <peter@eisentraut.org>
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