pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Gierth <rhodiumtoad@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Force tuple conversion when the source has missing attributes.
Date: Wed, 05 Feb 2020 20:24:44 +0000
Message-ID: <E1izRE4-00052N-1F@gemulon.postgresql.org> (raw)

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



view thread (3+ messages)

Message-ID: <E1izRE4-00052N-1F@gemulon.postgresql.org>
Permalink:  ../E1izRE4-00052N-1F@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1izRE4-00052N-1F@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: rhodiumtoad@postgresql.org
  Subject: Re: pgsql: Force tuple conversion when the source has missing attributes.
  In-Reply-To: <E1izRE4-00052N-1F@gemulon.postgresql.org>
  References: <E1izRE4-00052N-1F@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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