Fix pg12 compatibility wrt. 7d872c91a3f

This commit introduced a new root->append_rel_array that's setup just
before we get a change to fill in the necessary data in root->append_rel_list.

For now, we call setup_append_rel_array() (and free previously palloc'd
memory if needed) for each hypo_injectHypotheticalPartitioning() call,
but this is a waste of cycles, we'll need to call it ideally only once
per query execution.
This commit is contained in:
Julien Rouhaud 2018-07-21 00:08:44 +02:00
parent 21ae10ac3c
commit 4a9adb9ca3

View file

@ -2019,6 +2019,21 @@ hypo_injectHypotheticalPartitioning(PlannerInfo *root,
rel->pages = (BlockNumber) pages;
rel->tuples = clamp_row_est(rel->tuples * selectivity);
}
/*
* This is done in query_planner just before add_base_rels_to_query() is
* called, so before get_relation_info_hook is called and setup
* root->append_rel_list
*
* FIXME find a way to call it once per planning and not one per
* get_relation_info_hook call.
*/
if (root->append_rel_array)
{
pfree(root->append_rel_array);
root->append_rel_array = NULL;
}
setup_append_rel_array(root);
}