Fix failure when creating cloned indexes for a partition
authorMichael Paquier <[email protected]>
Sat, 2 Nov 2019 05:16:04 +0000 (14:16 +0900)
committerMichael Paquier <[email protected]>
Sat, 2 Nov 2019 05:16:04 +0000 (14:16 +0900)
commitdc816e5815913e2b2ae2327a4d3e4d4416ed6898
treee565b12597829a439818fd30da5595fb8050e9b1
parente174f699c476a4cc01875211a5f43e57c3190a37
Fix failure when creating cloned indexes for a partition

When using CREATE TABLE for a new partition, the partitioned indexes of
the parent are created automatically in a fashion similar to LIKE
INDEXES.  The new partition and its parent use a mapping for attribute
numbers for this operation, and while the mapping was correctly built,
its length was defined as the number of attributes of the newly-created
child, and not the parent.  If the parent includes dropped columns, this
could cause failures.

This is wrong since 8b08f7d which has introduced the concept of
partitioned indexes, so back down to 11.

Reported-by: Wyatt Alt
Author: Michael Paquier
Reviewed-by: Amit Langote
Discussion: https://postgr.es/m/CAGem3qCcRmhbs4jYMkenYNfP2kEusDXvTfw-q+eOhM0zTceG-g@mail.gmail.com
Back-through: 11
src/backend/commands/tablecmds.c
src/test/regress/expected/create_table.out
src/test/regress/sql/create_table.sql