Обсуждение: pgsql: Allow for pg_upgrade of attributes with missing values

Поиск
Список
Период
Сортировка

pgsql: Allow for pg_upgrade of attributes with missing values

От
Andrew Dunstan
Дата:
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(-)


Re: pgsql: Allow for pg_upgrade of attributes with missing values

От
Tom Lane
Дата:
Andrew Dunstan <andrew@dunslane.net> writes:
> Allow for pg_upgrade of attributes with missing values

Buildfarm results suggest that binary_upgrade_set_missing_value should
have been marked proparallel => 'u'.

            regards, tom lane


Re: pgsql: Allow for pg_upgrade of attributes with missing values

От
Andrew Dunstan
Дата:

On 06/22/2018 11:03 PM, Tom Lane wrote:
> Andrew Dunstan <andrew@dunslane.net> writes:
>> Allow for pg_upgrade of attributes with missing values
> Buildfarm results suggest that binary_upgrade_set_missing_value should
> have been marked proparallel => 'u'.


Argh! I'll fix it in the morning, along with adding "force_parallel = 
regress" to my testing regime. I guess I'll need to bump the cat version 
again?

cheers

andrew

-- 
Andrew Dunstan                https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services