match_clause_to_index should check only key columns
authorTeodor Sigaev <[email protected]>
Sun, 8 Apr 2018 16:58:15 +0000 (19:58 +0300)
committerTeodor Sigaev <[email protected]>
Sun, 8 Apr 2018 16:58:15 +0000 (19:58 +0300)
Alexander Korotkov per gripe from Tom Lane noticed on valgrind-enabled
buildfarm members

src/backend/optimizer/path/indxpath.c

index cc607dcdfaa55eed1249b5a80a693a650c615d44..bf42b54970c1e72ebbdff942b193b3fbd030ccb5 100644 (file)
@@ -2244,8 +2244,8 @@ match_clause_to_index(IndexOptInfo *index,
        if (!restriction_is_securely_promotable(rinfo, index->rel))
                return;
 
-       /* OK, check each index column for a match */
-       for (indexcol = 0; indexcol < index->ncolumns; indexcol++)
+       /* OK, check each index key column for a match */
+       for (indexcol = 0; indexcol < index->nkeycolumns; indexcol++)
        {
                if (match_clause_to_indexcol(index,
                                                                         indexcol,