pgsql: Force tuple conversion when the source has missing attributes.

From: Andrew Gierth <rhodiumtoad(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Force tuple conversion when the source has missing attributes.
Date: 2020-02-05 20:24:44
Message-ID: E1izRE4-00052N-1F@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2020-02-06 00:23:33 pgsql: Add leader_pid to pg_stat_activity
Previous Message Alvaro Herrera 2020-02-05 20:15:34 pgsql: Make vacuum buffer counters 64 bits wide