]> granicus.if.org Git - postgresql/commit
Fix partitioned index creation bug with dropped columns
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 26 Mar 2019 23:19:28 +0000 (20:19 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 26 Mar 2019 23:19:28 +0000 (20:19 -0300)
commit126d631222328d3def7910934bfa9cbdc99d79cc
tree791e0890494ec8cfae7f1a87f58c148d545521e5
parent53bcf5e3dbeaed5baf9d09b124cf196d247c54ea
Fix partitioned index creation bug with dropped columns

ALTER INDEX .. ATTACH PARTITION fails if the partitioned table where the
index is defined contains more dropped columns than its partition, with
this message:
  ERROR:  incorrect attribute map
The cause was that one caller of CompareIndexInfo was passing the number
of attributes of the partition rather than the parent, which confused
the length check.  Repair.

This can cause pg_upgrade to fail when used on such a database.  Leave
some more objects around after regression tests, so that the case is
detected by pg_upgrade test suite.

Remove some spurious empty lines noticed while looking for other cases
of the same problem.

Discussion: https://postgr.es/m/20190326213924.GA2322@alvherre.pgsql
src/backend/catalog/index.c
src/backend/commands/indexcmds.c
src/backend/commands/tablecmds.c
src/test/regress/expected/indexing.out
src/test/regress/sql/indexing.sql