@@ -1011,11 +1011,11 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
1011
1011
1012
1012
/* Check if expression tree is a partitioning expression */
1013
1013
if (!match_expr_to_operand (context -> prel_expr , part_expr ))
1014
- goto handle_arrexpr_return ;
1014
+ goto handle_arrexpr_all ;
1015
1015
1016
1016
/* Check if we can work with this strategy */
1017
1017
if (strategy == 0 )
1018
- goto handle_arrexpr_return ;
1018
+ goto handle_arrexpr_all ;
1019
1019
1020
1020
/* Examine the array node */
1021
1021
switch (nodeTag (array ))
@@ -1026,7 +1026,7 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
1026
1026
1027
1027
/* Array is NULL */
1028
1028
if (c -> constisnull )
1029
- goto handle_arrexpr_return ;
1029
+ goto handle_arrexpr_none ;
1030
1030
1031
1031
/* Examine array */
1032
1032
handle_array (DatumGetArrayTypeP (c -> constvalue ),
@@ -1048,7 +1048,7 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
1048
1048
ListCell * lc ;
1049
1049
1050
1050
if (list_length (arr_expr -> elements ) == 0 )
1051
- goto handle_arrexpr_return ;
1051
+ goto handle_arrexpr_all ;
1052
1052
1053
1053
/* Set default ranges for OR | AND */
1054
1054
ranges = expr -> useOr ? NIL : list_make1_irange_full (prel , IR_COMPLETE );
@@ -1068,21 +1068,19 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
1068
1068
{
1069
1069
Const * c = ExtractConst (elem , context );
1070
1070
1071
- /* Is this an array?.. */
1072
- if (c -> consttype != elem_type )
1071
+ /* Is this an array?. */
1072
+ if (c -> consttype != elem_type && ! c -> constisnull )
1073
1073
{
1074
- /* Array is NULL */
1075
- if (c -> constisnull )
1076
- goto handle_arrexpr_return ;
1077
-
1078
- /* Examine array */
1079
1074
handle_array (DatumGetArrayTypeP (c -> constvalue ),
1080
1075
expr -> inputcollid , strategy ,
1081
1076
expr -> useOr , context , & wrap );
1082
1077
}
1083
1078
/* ... 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
+ }
1086
1084
1087
1085
/* Should we use OR | AND? */
1088
1086
ranges = expr -> useOr ?
@@ -1097,7 +1095,7 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
1097
1095
{
1098
1096
/* We can't say anything if PARAMs + ANY */
1099
1097
if (expr -> useOr )
1100
- goto handle_arrexpr_return ;
1098
+ goto handle_arrexpr_all ;
1101
1099
1102
1100
/* Recheck condition on a narrowed set of partitions */
1103
1101
ranges = irange_list_set_lossiness (ranges , IR_LOSSY );
@@ -1116,12 +1114,23 @@ handle_arrexpr(const ScalarArrayOpExpr *expr,
1116
1114
break ;
1117
1115
}
1118
1116
1119
- handle_arrexpr_return :
1117
+ handle_arrexpr_all :
1120
1118
result -> rangeset = list_make1_irange_full (prel , IR_LOSSY );
1121
1119
result -> paramsel = estimate_paramsel_using_prel (prel , strategy );
1122
1120
1123
1121
/* Save expression */
1124
1122
result -> 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 ;
1125
1134
}
1126
1135
1127
1136
/* Operator expression handler */
0 commit comments