Skip to content

Commit 2bbdd2d

Browse files
author
Maksim Milyutin
committed
Add compat version of get_cheapest_path_for_pathkeys routine
1 parent 639f014 commit 2bbdd2d

File tree

2 files changed

+34
-35
lines changed

2 files changed

+34
-35
lines changed

src/include/compat/pg_compat.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,25 @@ extern List *get_all_actual_clauses(List *restrictinfo_list);
300300
#endif
301301

302302

303+
/*
304+
* get_cheapest_path_for_pathkeys()
305+
*/
306+
#if PG_VERSION_NUM >= 100000
307+
#define get_cheapest_path_for_pathkeys_compat(paths, pathkeys, required_outer, \
308+
cost_criterion, \
309+
require_parallel_safe) \
310+
get_cheapest_path_for_pathkeys((paths), (pathkeys), (required_outer), \
311+
(cost_criterion), \
312+
(require_parallel_safe))
313+
#elif PG_VERSION_NUM >= 90500
314+
#define get_cheapest_path_for_pathkeys_compat(paths, pathkeys, required_outer, \
315+
cost_criterion, \
316+
require_parallel_safe) \
317+
get_cheapest_path_for_pathkeys((paths), (pathkeys), (required_outer), \
318+
(cost_criterion))
319+
#endif
320+
321+
303322
/*
304323
* get_parameterized_joinrel_size()
305324
*/

src/pg_pathman.c

Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,31 +1489,18 @@ generate_mergeappend_paths(PlannerInfo *root, RelOptInfo *rel,
14891489
*cheapest_total;
14901490

14911491
/* Locate the right paths, if they are available. */
1492-
#if PG_VERSION_NUM >= 100000
1493-
cheapest_startup =
1494-
get_cheapest_path_for_pathkeys(childrel->pathlist,
1495-
pathkeys,
1496-
NULL,
1497-
STARTUP_COST,
1498-
true);
1499-
cheapest_total =
1500-
get_cheapest_path_for_pathkeys(childrel->pathlist,
1501-
pathkeys,
1502-
NULL,
1503-
TOTAL_COST,
1504-
true);
1505-
#else
15061492
cheapest_startup =
1507-
get_cheapest_path_for_pathkeys(childrel->pathlist,
1508-
pathkeys,
1509-
NULL,
1510-
STARTUP_COST);
1493+
get_cheapest_path_for_pathkeys_compat(childrel->pathlist,
1494+
pathkeys,
1495+
NULL,
1496+
STARTUP_COST,
1497+
false);
15111498
cheapest_total =
1512-
get_cheapest_path_for_pathkeys(childrel->pathlist,
1513-
pathkeys,
1514-
NULL,
1515-
TOTAL_COST);
1516-
#endif
1499+
get_cheapest_path_for_pathkeys_compat(childrel->pathlist,
1500+
pathkeys,
1501+
NULL,
1502+
TOTAL_COST,
1503+
false);
15171504

15181505
/*
15191506
* If we can't find any paths with the right order just use the
@@ -2091,18 +2078,11 @@ get_cheapest_parameterized_child_path(PlannerInfo *root, RelOptInfo *rel,
20912078
* parameterization. If it has exactly the needed parameterization, we're
20922079
* done.
20932080
*/
2094-
#if PG_VERSION_NUM >= 100000
2095-
cheapest = get_cheapest_path_for_pathkeys(rel->pathlist,
2096-
NIL,
2097-
required_outer,
2098-
TOTAL_COST,
2099-
false);
2100-
#else
2101-
cheapest = get_cheapest_path_for_pathkeys(rel->pathlist,
2102-
NIL,
2103-
required_outer,
2104-
TOTAL_COST);
2105-
#endif
2081+
cheapest = get_cheapest_path_for_pathkeys_compat(rel->pathlist,
2082+
NIL,
2083+
required_outer,
2084+
TOTAL_COST,
2085+
false);
21062086
Assert(cheapest != NULL);
21072087
if (bms_equal(PATH_REQ_OUTER(cheapest), required_outer))
21082088
return cheapest;

0 commit comments

Comments
 (0)