pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Force tuple conversion when the source has missing attributes. 3+ messages / 1 participants [nested] [flat]
* pgsql: Force tuple conversion when the source has missing attributes. @ 2020-02-05 20:24 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Andrew Gierth @ 2020-02-05 20:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force tuple conversion when the source has missing attributes. Tuple conversion incorrectly concluded that no conversion was needed as long as all the attributes lined up. But if the source tuple has a missing attribute (from addition of a column with default), then the destination tupdesc might not reflect the same default. The typical symptom was that the affected columns would be unexpectedly NULL. Repair by always forcing conversion if the source has missing attributes, which will be filled in by the deform operation. (In theory we could optimize for when the destination has the same default, but that seemed overkill.) Backpatch to 11 where missing attributes were added. Per bug #16242. Vik Fearing (discovery, code, testing) and me (analysis, testcase). Discussion: https://postgr.es/m/16242-d1c9fca28445966b@postgresql.org Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/bf6cc19e347d4cb8dfc8f05a59171ac06e18b5e5 Modified Files -------------- src/backend/access/common/attmap.c | 12 ++++++---- src/test/regress/expected/alter_table.out | 38 ++++++++++++++++++++++++++++++ src/test/regress/sql/alter_table.sql | 39 +++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 4 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Force tuple conversion when the source has missing attributes. @ 2020-02-05 20:24 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Andrew Gierth @ 2020-02-05 20:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force tuple conversion when the source has missing attributes. Tuple conversion incorrectly concluded that no conversion was needed as long as all the attributes lined up. But if the source tuple has a missing attribute (from addition of a column with default), then the destination tupdesc might not reflect the same default. The typical symptom was that the affected columns would be unexpectedly NULL. Repair by always forcing conversion if the source has missing attributes, which will be filled in by the deform operation. (In theory we could optimize for when the destination has the same default, but that seemed overkill.) Backpatch to 11 where missing attributes were added. Per bug #16242. Vik Fearing (discovery, code, testing) and me (analysis, testcase). Discussion: https://postgr.es/m/16242-d1c9fca28445966b@postgresql.org Branch ------ REL_12_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/0e37489ed682d29e8e010abbb1b28fa91237539a Modified Files -------------- src/backend/access/common/tupconvert.c | 32 ++++++++++++++++++------- src/test/regress/expected/alter_table.out | 38 ++++++++++++++++++++++++++++++ src/test/regress/sql/alter_table.sql | 39 +++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Force tuple conversion when the source has missing attributes. @ 2020-02-05 20:24 Andrew Gierth <rhodiumtoad@postgresql.org> 0 siblings, 0 replies; 3+ messages in thread From: Andrew Gierth @ 2020-02-05 20:24 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Force tuple conversion when the source has missing attributes. Tuple conversion incorrectly concluded that no conversion was needed as long as all the attributes lined up. But if the source tuple has a missing attribute (from addition of a column with default), then the destination tupdesc might not reflect the same default. The typical symptom was that the affected columns would be unexpectedly NULL. Repair by always forcing conversion if the source has missing attributes, which will be filled in by the deform operation. (In theory we could optimize for when the destination has the same default, but that seemed overkill.) Backpatch to 11 where missing attributes were added. Per bug #16242. Vik Fearing (discovery, code, testing) and me (analysis, testcase). Discussion: https://postgr.es/m/16242-d1c9fca28445966b@postgresql.org Branch ------ REL_11_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d8f1c03a46fbb53ed28f1bb6b39ba2e3dfdc78d5 Modified Files -------------- src/backend/access/common/tupconvert.c | 32 ++++++++++++++++++------- src/test/regress/expected/alter_table.out | 38 ++++++++++++++++++++++++++++++ src/test/regress/sql/alter_table.sql | 39 +++++++++++++++++++++++++++++++ 3 files changed, 101 insertions(+), 8 deletions(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2020-02-05 20:24 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-02-05 20:24 pgsql: Force tuple conversion when the source has missing attributes. Andrew Gierth <rhodiumtoad@postgresql.org> 2020-02-05 20:24 pgsql: Force tuple conversion when the source has missing attributes. Andrew Gierth <rhodiumtoad@postgresql.org> 2020-02-05 20:24 pgsql: Force tuple conversion when the source has missing attributes. Andrew Gierth <rhodiumtoad@postgresql.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