pgsql: pg_plan_advice: Avoid a crash under GEQO.

From: Robert Haas <rhaas(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: pg_plan_advice: Avoid a crash under GEQO.
Date: 2026-03-17 18:46:57
Message-ID: E1w2ZRQ-000Cln-2w@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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 <exclusion(at)gmail(dot)com>
Discussion: http://postgr.es/m/a6e6d603-e847-44dc-acd5-879fb4570062@gmail.com

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(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2026-03-17 18:55:05 pgsql: Fix use of wrong variable in _hash_kill_items()
Previous Message Robert Haas 2026-03-17 18:15:40 pgsql: Test pg_plan_advice using a new test_plan_advice module.