pg_plan_advice: Avoid a crash under GEQO.

The previous code could allocate pgpa_sj_unique_rel objects in a context
that had too short a lifespan. Fix by allocating them (and any
associated List-related allocations) in the same context as the
pgpa_planner_state to which they are attached. We also need to copy
uniquerel->relids, because the associated RelOptInfo may also be
allocated within a short-lived context.

Reported-by: Alexander Lakhin <[email protected]>
Discussion: http://postgr.es/m/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/01b02c0ecad1bb4e884614a00a5c619f20480823

Modified Files
--------------
contrib/pg_plan_advice/pgpa_planner.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)

Reply via email to