@@ -1011,11 +1011,11 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
10111011
10121012/* Check if expression tree is a partitioning expression */
10131013if (!match_expr_to_operand (context -> prel_expr ,part_expr ))
1014- gotohandle_arrexpr_return ;
1014+ gotohandle_arrexpr_all ;
10151015
10161016/* Check if we can work with this strategy */
10171017if (strategy == 0 )
1018- gotohandle_arrexpr_return ;
1018+ gotohandle_arrexpr_all ;
10191019
10201020/* Examine the array node */
10211021switch (nodeTag (array ))
@@ -1026,7 +1026,7 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
10261026
10271027/* Array is NULL */
10281028if (c -> constisnull )
1029- gotohandle_arrexpr_return ;
1029+ gotohandle_arrexpr_none ;
10301030
10311031/* Examine array */
10321032handle_array (DatumGetArrayTypeP (c -> constvalue ),
@@ -1048,7 +1048,7 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
10481048ListCell * lc ;
10491049
10501050if (list_length (arr_expr -> elements )== 0 )
1051- gotohandle_arrexpr_return ;
1051+ gotohandle_arrexpr_all ;
10521052
10531053/* Set default ranges for OR | AND */
10541054ranges = expr -> useOr ?NIL :list_make1_irange_full (prel ,IR_COMPLETE );
@@ -1068,21 +1068,19 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
10681068{
10691069Const * c = ExtractConst (elem ,context );
10701070
1071- /* Is this an array?.. */
1072- if (c -> consttype != elem_type )
1071+ /* Is this an array?. */
1072+ if (c -> consttype != elem_type && ! c -> constisnull )
10731073{
1074- /* Array is NULL */
1075- if (c -> constisnull )
1076- gotohandle_arrexpr_return ;
1077-
1078- /* Examine array */
10791074handle_array (DatumGetArrayTypeP (c -> constvalue ),
10801075expr -> inputcollid ,strategy ,
10811076expr -> useOr ,context ,& wrap );
10821077}
10831078/* ... or a single element? */
1084- else handle_const (c ,expr -> inputcollid ,
1085- strategy ,context ,& wrap );
1079+ else
1080+ {
1081+ handle_const (c ,expr -> inputcollid ,
1082+ strategy ,context ,& wrap );
1083+ }
10861084
10871085/* Should we use OR | AND? */
10881086ranges = expr -> useOr ?
@@ -1097,7 +1095,7 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
10971095{
10981096/* We can't say anything if PARAMs + ANY */
10991097if (expr -> useOr )
1100- gotohandle_arrexpr_return ;
1098+ gotohandle_arrexpr_all ;
11011099
11021100/* Recheck condition on a narrowed set of partitions */
11031101ranges = irange_list_set_lossiness (ranges ,IR_LOSSY );
@@ -1116,12 +1114,23 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
11161114break ;
11171115}
11181116
1119- handle_arrexpr_return :
1117+ handle_arrexpr_all :
11201118result -> rangeset = list_make1_irange_full (prel ,IR_LOSSY );
11211119result -> paramsel = estimate_paramsel_using_prel (prel ,strategy );
11221120
11231121/* Save expression */
11241122result -> orig = (const Node * )expr ;
1123+
1124+ return ;
1125+
1126+ handle_arrexpr_none :
1127+ result -> rangeset = NIL ;
1128+ result -> paramsel = 0.0 ;
1129+
1130+ /* Save expression */
1131+ result -> orig = (const Node * )expr ;
1132+
1133+ return ;
11251134}
11261135
11271136/* Operator expression handler */