]> granicus.if.org Git - postgresql/commit
Fix dependency handling of column drop with partitioned tables
authorMichael Paquier <michael@paquier.xyz>
Sun, 13 Oct 2019 08:53:08 +0000 (17:53 +0900)
committerMichael Paquier <michael@paquier.xyz>
Sun, 13 Oct 2019 08:53:08 +0000 (17:53 +0900)
commit3a58c5f1464bf5bb5e602477222da88ee201392c
tree39b925443d97fa836624899c8fdaa3c46d14914a
parent3fb14cfcbd7999d71a7a5d83ffcbeee08c5228db
Fix dependency handling of column drop with partitioned tables

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
Reviewed-by: Álvaro Herrera, Ashutosh Sharma
Discussion: https://postgr.es/m/CA+HiwqE9kuBsZ3b5pob2-cvE8ofzPWs-og+g8bKKGnu6b4-yTQ@mail.gmail.com
Backpatch-through: 12
src/backend/commands/tablecmds.c
src/test/regress/expected/indexing.out
src/test/regress/sql/indexing.sql