Skip to content

Commit cc6b1e8

Browse files
committed
Add compat version of build_simple_rel routine
1 parent 981e769 commit cc6b1e8

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/include/compat/pg_compat.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,19 @@
7575
#endif
7676

7777

78+
/*
79+
* build_simple_rel()
80+
*/
81+
#if PG_VERSION_NUM >= 100000
82+
#define build_simple_rel_compat(root, childRTindex, parent_rel) \
83+
build_simple_rel((root), (childRTindex), (parent_rel))
84+
#elif PG_VERSION_NUM >= 90500
85+
#define build_simple_rel_compat(root, childRTindex, parent_rel) \
86+
build_simple_rel((root), (childRTindex), \
87+
(parent_rel) ? RELOPT_OTHER_MEMBER_REL : RELOPT_BASEREL)
88+
#endif
89+
90+
7891
/*
7992
* Define ALLOCSET_DEFAULT_SIZES for our precious MemoryContexts
8093
*/

src/pg_pathman.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,7 @@ append_child_relation(PlannerInfo *root, Relation parent_relation,
338338
root->simple_rte_array[childRTindex] = child_rte;
339339

340340
/* Create RelOptInfo for this child (and make some estimates as well) */
341-
#if PG_VERSION_NUM >= 100000
342-
child_rel = build_simple_rel(root, childRTindex, parent_rel);
343-
#else
344-
child_rel = build_simple_rel(root, childRTindex, RELOPT_OTHER_MEMBER_REL);
345-
#endif
341+
child_rel = build_simple_rel_compat(root, childRTindex, parent_rel);
346342

347343
/* Increase total_table_pages using the 'child_rel' */
348344
root->total_table_pages += (double) child_rel->pages;

0 commit comments

Comments
 (0)