pgsql: Fix for dropped columns in a partitioned table's default partiti

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix for dropped columns in a partitioned table's default partiti
Date: 2019-06-28 18:52:22
Message-ID: E1hgvyw-0005Wr-Br@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix for dropped columns in a partitioned table's default partition

We forgot to map column numbers to/from the default partition for
various operations, leading to valid cases failing with spurious
errors, such as
ERROR: attribute N of type some_partition has been dropped

It was also possible that the search for conflicting rows in the default
partition when attaching another partition would fail to detect some.
Secondarily, it was also possible that such a search should be skipped
(because the constraint was implied) but wasn't.

Fix all this by mapping column numbers when necessary.

Reported by: Daniel Wilches
Author: Amit Langote
Discussion: https://postgr.es/m/15873-8c61945d6b3ef87c@postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/23cccb17fe0bbb5df86780da5c346cc060c21421

Modified Files
--------------
src/backend/commands/tablecmds.c | 7 +++++++
src/backend/partitioning/partbounds.c | 24 +++++++++++++++++++-----
src/test/regress/expected/alter_table.out | 9 ++++++++-
src/test/regress/expected/create_table.out | 14 ++++++++++++++
src/test/regress/sql/alter_table.sql | 9 ++++++++-
src/test/regress/sql/create_table.sql | 14 ++++++++++++++
6 files changed, 70 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2019-06-29 02:23:05 pgsql: Remove unnecessary header from be-secure-gssapi.c
Previous Message Thomas Munro 2019-06-28 05:26:36 pgsql: Fix misleading comment in nodeIndexonlyscan.c.