Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0705b02

Browse files
committed
OR clause index fix
1 parentcbf8319 commit0705b02

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

‎src/backend/optimizer/path/indxpath.c

Lines changed: 3 additions & 3 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.31 1998/08/19 02:02:11 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.32 1998/08/31 07:19:54 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -340,10 +340,10 @@ match_index_orclause(RelOptInfo *rel,
340340
index)&&
341341
IsA(get_rightop((Expr*)clause),Const))||
342342
(match_index_to_operand(indexkey,
343-
(Expr*)get_leftop((Expr*)clause),
343+
(Expr*)get_rightop((Expr*)clause),
344344
rel,
345345
index)&&
346-
IsA(get_rightop((Expr*)clause),Const))))
346+
IsA(get_leftop((Expr*)clause),Const))))
347347
{
348348
lfirst(matching_indices)=lcons(index,lfirst(matching_indices));
349349
}

‎src/backend/optimizer/path/orindxpath.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.8 1998/08/01 22:12:13 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/path/orindxpath.c,v 1.9 1998/08/31 07:19:55 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -84,6 +84,7 @@ create_or_index_paths(Query *root,
8484
break;
8585
}
8686
}
87+
/* do they all have indexes? */
8788
if (index_flag)
8889
{/* used to be a lisp every function */
8990
IndexPath*pathnode=makeNode(IndexPath);
@@ -215,6 +216,11 @@ best_or_subclause_index(Query *root,
215216
{
216217
List*ilist;
217218
boolfirst_run= true;
219+
220+
/* if we don't match anything, return zeros */
221+
*retIndexid=0;
222+
*retCost=0.0;
223+
*retSelec=0.0;
218224

219225
foreach (ilist,indices)
220226
{
@@ -268,12 +274,5 @@ best_or_subclause_index(Query *root,
268274
}
269275
}
270276

271-
/* we didn't get any indexes, so zero return values */
272-
if (first_run)
273-
{
274-
*retIndexid=0;
275-
*retCost=0.0;
276-
*retSelec=0.0;
277-
}
278277
return;
279278
}

‎src/backend/optimizer/util/clauses.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.20 1998/08/10 02:26:29 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.21 1998/08/31 07:19:56 momjian Exp $
1111
*
1212
* HISTORY
1313
* AUTHORDATEMAJOR EVENT
@@ -198,9 +198,8 @@ make_funcclause(Func *func, List *funcargs)
198198
bool
199199
or_clause(Node*clause)
200200
{
201-
return
202-
(clause!=NULL&&
203-
nodeTag(clause)==T_Expr&& ((Expr*)clause)->opType==OR_EXPR);
201+
returnclause!=NULL&&
202+
nodeTag(clause)==T_Expr&& ((Expr*)clause)->opType==OR_EXPR);
204203
}
205204

206205
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp