pgsql: Allow for pg_upgrade of attributes with missing values

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow for pg_upgrade of attributes with missing values
Date: 2018-06-22 12:58:47
Message-ID: E1fWLeJ-0006wh-4F@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow for pg_upgrade of attributes with missing values

Commit 16828d5c02 neglected to do this, so upgraded databases would
silently get null instead of the specified default in rows without the
attribute defined.

A new binary upgrade function is provided to perform this and pg_dump is
adjusted to output a call to the function if required in binary upgrade
mode.

Also included is code to drop missing attribute values for dropped
columns. That way if the type is later dropped the missing value won't
have a dangling reference to the type.

Finally the regression tests are adjusted to ensure that there is a row
with a missing value so that this code is exercised in upgrade testing.

Catalog version unfortunately bumped.

Regression test changes from Tom Lane.
Remainder from me, reviewed by Tom Lane, Andres Freund, Alvaro Herrera

Discussion: https://postgr.es/m/19987.1529420110@sss.pgh.pa.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/2448adf29c543befbac59f1ecfbb3ef4b0d808ce

Modified Files
--------------
src/backend/catalog/heap.c | 80 ++++++++++++++++++++++++++++++
src/backend/utils/adt/pg_upgrade_support.c | 16 ++++++
src/bin/pg_dump/pg_dump.c | 71 +++++++++++++++++++++++---
src/bin/pg_dump/pg_dump.h | 1 +
src/include/catalog/catversion.h | 2 +-
src/include/catalog/heap.h | 1 +
src/include/catalog/pg_proc.dat | 4 ++
src/test/regress/expected/fast_default.out | 11 ++++
src/test/regress/sql/fast_default.sql | 7 +++
9 files changed, 186 insertions(+), 7 deletions(-)

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Robert Haas 2018-06-22 13:21:44 pgsql: Avoid generating bogus paths with partitionwise aggregate.
Previous Message Alexander Korotkov 2018-06-22 09:26:47 pgsql: Fixes for vacuum_cleanup_index_scale_factor GUC option