diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c index 3fb2344198..51dadb04cf 100644 --- a/src/backend/commands/indexcmds.c +++ b/src/backend/commands/indexcmds.c @@ -182,9 +182,13 @@ CheckIndexCompatible(Oid oldId, * the new index, so we can test whether it's compatible with the existing * one. Note that ComputeIndexAttrs might fail here, but that's OK: * DefineIndex would have called this function with the same arguments - * later on, and it would have failed then anyway. + * later on, and it would have failed then anyway. Our attributeList + * contains only key attributes, thus we're filling ii_NumIndexAttrs and + * ii_NumIndexKeyAttrs with same value. */ indexInfo = makeNode(IndexInfo); + indexInfo->ii_NumIndexAttrs = numberOfAttributes; + indexInfo->ii_NumIndexKeyAttrs = numberOfAttributes; indexInfo->ii_Expressions = NIL; indexInfo->ii_ExpressionsState = NIL; indexInfo->ii_PredicateState = NULL; @@ -1523,6 +1527,7 @@ ComputeIndexAttrs(IndexInfo *indexInfo, if (attn >= nkeycols) { colOptionP[attn] = 0; + classOidP[attn] = InvalidOid; attn++; continue; }