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

Commit3d6e538

Browse files
committed
pred_test() logic was being too narrow-minded about where it might find
RestrictInfo nodes in the query expression. Per example from James Robinson.
1 parent98e8b48 commit3d6e538

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

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

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.165 2004/10/11 22:56:56 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.166 2004/11/05 20:45:10 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -848,13 +848,9 @@ pred_test_restrict_list(Expr *predicate, List *restrictinfo_list)
848848

849849
foreach(item,restrictinfo_list)
850850
{
851-
RestrictInfo*restrictinfo= (RestrictInfo*)lfirst(item);
852-
853-
Assert(IsA(restrictinfo,RestrictInfo));
854-
855851
/* if any clause implies the predicate, return true */
856852
if (pred_test_recurse_restrict(predicate,
857-
(Node*)restrictinfo->clause))
853+
(Node*)lfirst(item)))
858854
return true;
859855
}
860856
return false;
@@ -865,7 +861,8 @@ pred_test_restrict_list(Expr *predicate, List *restrictinfo_list)
865861
* pred_test_recurse_restrict
866862
* Does the "predicate inclusion test" for one element of a predicate
867863
* expression. Here we recursively deal with the possibility that the
868-
* restriction-list element is itself an AND or OR structure.
864+
* restriction-list element is itself an AND or OR structure; also,
865+
* we strip off RestrictInfo nodes to find bare predicate expressions.
869866
*/
870867
staticbool
871868
pred_test_recurse_restrict(Expr*predicate,Node*clause)
@@ -874,7 +871,14 @@ pred_test_recurse_restrict(Expr *predicate, Node *clause)
874871
ListCell*item;
875872

876873
Assert(clause!=NULL);
877-
if (or_clause(clause))
874+
if (IsA(clause,RestrictInfo))
875+
{
876+
RestrictInfo*restrictinfo= (RestrictInfo*)clause;
877+
878+
returnpred_test_recurse_restrict(predicate,
879+
(Node*)restrictinfo->clause);
880+
}
881+
elseif (or_clause(clause))
878882
{
879883
items= ((BoolExpr*)clause)->args;
880884
foreach(item,items)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp