When dropping a column on a partitioned table which has one or more partitioned indexes, the operation was failing as dependencies with partitioned indexes using the column dropped were not getting removed in a way consistent with the columns involved across all the relations part of an inheritance tree.
This commit refactors the code executing column drop so as all the columns from an inheritance tree to remove are gathered first, and dropped all at the end. This way, we let the dependency machinery sort out by itself the deletion of all the columns with the partitioned indexes across a partition tree.
This issue has been introduced by 1d92a0c, so backpatch down to REL_12_STABLE.
Author: Amit Langote, Michael Paquier
1df5875d39 Fix dependency handling of column drop with partitioned tables
src/backend/commands/tablecmds.c | 41 +++++++++++++++++------
src/test/regress/expected/indexing.out | 61 ++++++++++++++++++++++++++++++++++
src/test/regress/sql/indexing.sql | 21 ++++++++++++
3 files changed, 113 insertions(+), 10 deletions(-)