@@ -477,6 +477,17 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
477
477
memset ((void * ) & root -> simple_rte_array [current_len ], 0 ,
478
478
irange_len * sizeof (RangeTblEntry * ));
479
479
480
+ #if PG_VERSION_NUM >= 110000
481
+ /* Make sure append_rel_array is wide enough */
482
+ if (root -> append_rel_array == NULL )
483
+ root -> append_rel_array = (AppendRelInfo * * ) palloc0 (0 );
484
+ root -> append_rel_array = (AppendRelInfo * * )
485
+ repalloc (root -> append_rel_array ,
486
+ new_len * sizeof (AppendRelInfo * ));
487
+ memset ((void * ) & root -> append_rel_array [current_len ], 0 ,
488
+ irange_len * sizeof (AppendRelInfo * ));
489
+ #endif
490
+
480
491
/* Don't forget to update array size! */
481
492
root -> simple_rel_array_size = new_len ;
482
493
}
@@ -485,7 +496,7 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
485
496
parent_rel = heap_open (rte -> relid , NoLock );
486
497
487
498
parent_rowmark = get_plan_rowmark (root -> rowMarks , rti );
488
-
499
+
489
500
/* Add parent if asked to */
490
501
if (prel -> enable_parent )
491
502
append_child_relation (root , parent_rel , parent_rowmark ,
@@ -514,21 +525,12 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
514
525
rel -> partial_pathlist = NIL ;
515
526
#endif
516
527
517
- /* Convert list to array for faster lookups */
518
- #if PG_VERSION_NUM >= 110000
519
- setup_append_rel_array (root );
520
- #endif
521
-
522
528
/* Generate new paths using the rels we've just added */
523
529
set_append_rel_pathlist (root , rel , rti , pathkeyAsc , pathkeyDesc );
524
530
set_append_rel_size_compat (root , rel , rti );
525
531
526
- /* consider gathering partial paths for the parent appendrel */
527
- #if PG_VERSION_NUM >= 110000
528
- generate_gather_paths (root , rel , false);
529
- #elif PG_VERSION_NUM >= 90600
530
- generate_gather_paths (root , rel );
531
- #endif
532
+ /* consider gathering partial paths for the parent appendrel */
533
+ generate_gather_paths_compat (root , rel );
532
534
533
535
/* Skip if both custom nodes are disabled */
534
536
if (!(pg_pathman_enable_runtimeappend ||
0 commit comments