]> granicus.if.org Git - postgresql/commit
Fix for dropped columns in a partitioned table's default partition
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 28 Jun 2019 18:51:08 +0000 (14:51 -0400)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 28 Jun 2019 18:51:08 +0000 (14:51 -0400)
commit23cccb17fe0bbb5df86780da5c346cc060c21421
tree16bdf996396cf2d17965fe5b3b635c64b59b7442
parent74b7cc8c02137f059703972aa14445b1e073f005
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
src/backend/commands/tablecmds.c
src/backend/partitioning/partbounds.c
src/test/regress/expected/alter_table.out
src/test/regress/expected/create_table.out
src/test/regress/sql/alter_table.sql
src/test/regress/sql/create_table.sql