]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Force tuple conversion when the source has missing attributes.
authorAndrew Gierth <rhodiumtoad@postgresql.org>
Wed, 5 Feb 2020 19:49:47 +0000 (19:49 +0000)
committerAndrew Gierth <rhodiumtoad@postgresql.org>
Wed, 5 Feb 2020 20:15:13 +0000 (20:15 +0000)
commitd8f1c03a46fbb53ed28f1bb6b39ba2e3dfdc78d5
tree3ee6686998dc1d95544a3b26049d6bf7049fe538
parent1265776a4d3075636a6090aece68b3528a126f92
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
src/backend/access/common/tupconvert.c
src/test/regress/expected/alter_table.out
src/test/regress/sql/alter_table.sql