From 02f3e558f21c0fbec9f94d5de9ad34f321eb0e57 Mon Sep 17 00:00:00 2001 From: Teodor Sigaev Date: Sun, 8 Apr 2018 19:58:15 +0300 Subject: [PATCH] match_clause_to_index should check only key columns Alexander Korotkov per gripe from Tom Lane noticed on valgrind-enabled buildfarm members --- src/backend/optimizer/path/indxpath.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c index cc607dcdfaa..bf42b54970c 100644 --- a/src/backend/optimizer/path/indxpath.c +++ b/src/backend/optimizer/path/indxpath.c @@ -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,