aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/tablecmds.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2019-03-26 20:19:39 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2019-03-26 20:19:39 -0300
commit7009f1a2df65598fc6c28368d3a6f1b9e96d69f5 (patch)
treee38169c4c2e38a5bfb408893e88aba5493816d57 /src/backend/commands/tablecmds.c
parente46072dc397fcdde3eebe6c4963d9692058da6e3 (diff)
downloadpostgresql-7009f1a2df65598fc6c28368d3a6f1b9e96d69f5.tar.gz
postgresql-7009f1a2df65598fc6c28368d3a6f1b9e96d69f5.zip
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
Diffstat (limited to 'src/backend/commands/tablecmds.c')
-rw-r--r--src/backend/commands/tablecmds.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index 0f72f51d372..23c2e923757 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -15518,7 +15518,7 @@ ATExecAttachPartitionIdx(List **wqueue, Relation parentIdx, RangeVar *name)
partIdx->rd_opfamily,
parentIdx->rd_opfamily,
attmap,
- RelationGetDescr(partTbl)->natts))
+ RelationGetDescr(parentTbl)->natts))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("cannot attach index \"%s\" as a partition of index \"%s\"",