pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_plan_advice: Avoid a crash under GEQO.
Date: Tue, 17 Mar 2026 18:46:57 +0000
Message-ID: <E1w2ZRQ-000Cln-2w@gemulon.postgresql.org> (raw)

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@gmail.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(-)



Message-ID: <E1w2ZRQ-000Cln-2w@gemulon.postgresql.org>
Permalink:  ../E1w2ZRQ-000Cln-2w@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1w2ZRQ-000Cln-2w@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: rhaas@postgresql.org, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: pg_plan_advice: Avoid a crash under GEQO.
  In-Reply-To: <E1w2ZRQ-000Cln-2w@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox