@@ -250,16 +250,18 @@ recursiveExtract(JsQueryItem *jsq, bool not, bool indirect, PathItem *path)
250
250
251
251
if (jsq -> type == jqiGreater || jsq -> type == jqiGreaterOrEqual )
252
252
{
253
+ result -> bounds .leftBound = (JsQueryItem * )palloc (sizeof (JsQueryItem ));
253
254
result -> bounds .leftInclusive = (jsq -> type == jqiGreaterOrEqual );
254
255
result -> bounds .rightBound = NULL ;
255
- result -> bounds .leftBound = ( JsQueryItem * ) palloc ( sizeof ( JsQueryItem )) ;
256
+ result -> bounds .rightInclusive = false ;
256
257
jsqGetArg (jsq , result -> bounds .leftBound );
257
258
}
258
259
else
259
260
{
261
+ result -> bounds .rightBound = (JsQueryItem * )palloc (sizeof (JsQueryItem ));
260
262
result -> bounds .rightInclusive = (jsq -> type == jqiLessOrEqual );
261
263
result -> bounds .leftBound = NULL ;
262
- result -> bounds .rightBound = ( JsQueryItem * ) palloc ( sizeof ( JsQueryItem )) ;
264
+ result -> bounds .leftInclusive = false ;
263
265
jsqGetArg (jsq , result -> bounds .rightBound );
264
266
}
265
267
return result ;
@@ -699,12 +701,13 @@ makeEntries(ExtractedNode *node, MakeEntryHandler handler, Pointer extra)
699
701
for (i = 0 ; i < node -> args .count ; i ++ )
700
702
{
701
703
child = node -> args .items [i ];
702
- if (!child ) continue ;
703
- if (child -> sClass > node -> sClass && !child -> forceIndex )
704
- {
705
- Assert (node -> type != eOr );
704
+ if (!child )
705
+ continue ;
706
+ /* Skip non-selective AND children */
707
+ if (child -> sClass > node -> sClass &&
708
+ node -> type == eAnd &&
709
+ !child -> forceIndex )
706
710
continue ;
707
- }
708
711
child = makeEntries (child , handler , extra );
709
712
if (child )
710
713
{
@@ -771,15 +774,15 @@ setSelectivityClass(ExtractedNode *node, CheckEntryHandler checkHandler,
771
774
if (!child )
772
775
continue ;
773
776
777
+ setSelectivityClass (child , checkHandler , extra );
778
+
774
779
if (!isLogicalNodeType (child -> type ))
775
780
{
776
781
if (child -> hint == jsqNoIndex ||
777
782
!checkHandler (child , extra ))
778
783
continue ;
779
784
}
780
785
781
- setSelectivityClass (child , checkHandler , extra );
782
-
783
786
if (child -> forceIndex )
784
787
node -> forceIndex = true;
785
788
0 commit comments