@@ -320,7 +320,7 @@ handle_modification_query(Query *parse)
320320 return ;
321321
322322 /* Parse syntax tree and extract partition ranges */
323- ranges = list_make1_irange (make_irange (0 , PrelChildrenCount (prel ) - 1 , false));
323+ ranges = list_make1_irange (make_irange (0 , PrelLastChild (prel ), false));
324324 expr = (Expr * ) eval_const_expressions (NULL , parse -> jointree -> quals );
325325 if (!expr )
326326 return ;
@@ -680,7 +680,7 @@ walk_expr_tree(Expr *expr, WalkerContext *context)
680680 result -> orig = (const Node * ) expr ;
681681 result -> args = NIL ;
682682 result -> rangeset = list_make1_irange (
683- make_irange (0 , PrelChildrenCount (context -> prel ) - 1 , true));
683+ make_irange (0 , PrelLastChild (context -> prel ), true));
684684 result -> paramsel = 1.0 ;
685685 return result ;
686686 }
@@ -839,7 +839,7 @@ create_partitions_internal(Oid relid, Datum value, Oid value_type)
839839
840840 /* Read max & min range values from PartRelationInfo */
841841 min_rvalue = prel -> ranges [0 ].min ;
842- max_rvalue = prel -> ranges [PrelChildrenCount (prel ) - 1 ].max ;
842+ max_rvalue = prel -> ranges [PrelLastChild (prel )].max ;
843843
844844 /* If this is a *date type*, cast 'range_interval' to INTERVAL */
845845 if (is_date_type_internal (value_type ))
@@ -1183,9 +1183,7 @@ handle_binary_opexpr(WalkerContext *context, WrapperNode *result,
11831183 elog (ERROR , "Unknown partitioning type %u" , prel -> parttype );
11841184 }
11851185
1186- result -> rangeset = list_make1_irange (make_irange (0 ,
1187- PrelChildrenCount (prel ) - 1 ,
1188- true));
1186+ result -> rangeset = list_make1_irange (make_irange (0 , PrelLastChild (prel ), true));
11891187 result -> paramsel = 1.0 ;
11901188}
11911189
@@ -1211,9 +1209,7 @@ handle_binary_opexpr_param(const PartRelationInfo *prel,
12111209 tce = lookup_type_cache (vartype , TYPECACHE_BTREE_OPFAMILY );
12121210 strategy = get_op_opfamily_strategy (expr -> opno , tce -> btree_opf );
12131211
1214- result -> rangeset = list_make1_irange (make_irange (0 ,
1215- PrelChildrenCount (prel ) - 1 ,
1216- true));
1212+ result -> rangeset = list_make1_irange (make_irange (0 , PrelLastChild (prel ), true));
12171213
12181214 if (strategy == BTEqualStrategyNumber )
12191215 {
@@ -1311,7 +1307,7 @@ handle_const(const Const *c, WalkerContext *context)
13111307 if (!context -> for_insert )
13121308 {
13131309 result -> rangeset = list_make1_irange (make_irange (0 ,
1314- PrelChildrenCount (prel ) - 1 ,
1310+ PrelLastChild (prel ),
13151311 true));
13161312 result -> paramsel = 1.0 ;
13171313
@@ -1382,9 +1378,7 @@ handle_opexpr(const OpExpr *expr, WalkerContext *context)
13821378 }
13831379 }
13841380
1385- result -> rangeset = list_make1_irange (make_irange (0 ,
1386- PrelChildrenCount (prel ) - 1 ,
1387- true));
1381+ result -> rangeset = list_make1_irange (make_irange (0 , PrelLastChild (prel ), true));
13881382 result -> paramsel = 1.0 ;
13891383 return result ;
13901384}
@@ -1456,7 +1450,7 @@ handle_boolexpr(const BoolExpr *expr, WalkerContext *context)
14561450
14571451 if (expr -> boolop == AND_EXPR )
14581452 result -> rangeset = list_make1_irange (make_irange (0 ,
1459- PrelChildrenCount (prel ) - 1 ,
1453+ PrelLastChild (prel ),
14601454 false));
14611455 else
14621456 result -> rangeset = NIL ;
@@ -1479,7 +1473,7 @@ handle_boolexpr(const BoolExpr *expr, WalkerContext *context)
14791473 break ;
14801474 default :
14811475 result -> rangeset = list_make1_irange (make_irange (0 ,
1482- PrelChildrenCount (prel ) - 1 ,
1476+ PrelLastChild (prel ),
14831477 false));
14841478 break ;
14851479 }
@@ -1581,9 +1575,7 @@ handle_arrexpr(const ScalarArrayOpExpr *expr, WalkerContext *context)
15811575 result -> paramsel = DEFAULT_INEQ_SEL ;
15821576
15831577handle_arrexpr_return :
1584- result -> rangeset = list_make1_irange (make_irange (0 ,
1585- PrelChildrenCount (prel ) - 1 ,
1586- true));
1578+ result -> rangeset = list_make1_irange (make_irange (0 , PrelLastChild (prel ), true));
15871579 return result ;
15881580}
15891581
0 commit comments