Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 39844ac

Browse files
committed
Fix for OR handling with multiple indexes.
1 parent 34aecb3 commit 39844ac

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/backend/optimizer/path/indxpath.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.21 1998/08/01 22:44:53 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.22 1998/08/02 07:10:38 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -307,13 +307,18 @@ match_index_orclause(RelOptInfo *rel,
307307
List *other_matching_indices)
308308
{
309309
Node *clause = NULL;
310-
List *matched_indices = other_matching_indices;
310+
List *matched_indices;
311311
List *index_list = NIL;
312312
List *clist;
313313

314314
foreach(clist, or_clauses)
315315
{
316316
clause = lfirst(clist);
317+
if (other_matching_indices)
318+
matched_indices = lfirst(other_matching_indices);
319+
else
320+
matched_indices = NIL;
321+
317322
if (is_opclause(clause) &&
318323
op_class(((Oper *) ((Expr *) clause)->oper)->opno,
319324
xclass, index->relam) &&
@@ -330,11 +335,12 @@ match_index_orclause(RelOptInfo *rel,
330335
{
331336
matched_indices = lcons(index, matched_indices);
332337
}
333-
index_list = lappend(index_list, matched_indices);
334338

335339
/* for the first index, we are creating the indexids list */
336-
if (matched_indices)
337-
matched_indices = lnext(matched_indices);
340+
index_list = lappend(index_list, matched_indices);
341+
342+
if (other_matching_indices)
343+
other_matching_indices = lnext(other_matching_indices);
338344
}
339345
return (index_list);
340346

0 commit comments

Comments
 (0)