pgsql: Fix table rewrites that include a column without a default.

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix table rewrites that include a column without a default.
Date: 2019-10-10 05:19:41
Message-ID: E1iIQrV-0005gk-1D@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix table rewrites that include a column without a default.

In c2fe139c201c I made ATRewriteTable() use tuple slots. Unfortunately
I did not notice that columns can be added in a rewrite that do not
have a default, when another column is added/altered requiring one.

Initialize columns to NULL again, and add tests.

Bug: #16038
Reported-By: anonymous
Author: Andres Freund
Discussion: https://postgr.es/m/16038-5c974541f2bf6749@postgresql.org
Backpatch: 12, where the bug was introduced in c2fe139c201c

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/93765bd956bea26206043de8cbb0ae4b67e4df15

Modified Files
--------------
src/backend/commands/tablecmds.c | 10 +++++++
src/test/regress/expected/alter_table.out | 47 ++++++++++++++++++++++++++++++
src/test/regress/sql/alter_table.sql | 48 +++++++++++++++++++++++++++++++
3 files changed, 105 insertions(+)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2019-10-10 05:19:44 pgsql: Fix table rewrites that include a column without a default.
Previous Message Michael Paquier 2019-10-10 03:56:35 Re: pgsql: Remove pqsignal() from libpq's official exports list.