agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
From: Robert Haas <rhaas@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: pg_plan_advice: Fix a bug when a subquery is pruned away entirel
Date: Mon, 13 Apr 2026 14:50:45 +0000
Message-ID: <E1wCIcf-000nmW-0a@gemulon.postgresql.org> (raw)

pg_plan_advice: Fix a bug when a subquery is pruned away entirely.

If a subquery is proven empty, and if that subquery contained a
semijoin, and if making one side or the other of that semijoin
unique and performing an inner join was a possible strategy, then
the previous code would fail with ERROR: no rtoffset for plan %s
when attempting to generate advice. Fix that.

Reported-by: Alexander Lakhin <exclusion@gmail.com>
Discussion: http://postgr.es/m/CA+TgmobOOmmXSJz3e+cjTY-bA1+W0dqVDqzxUBEvGtW62whYGg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0f93ebb3112d562fe54b685d0ca08c5ba1b41467

Modified Files
--------------
contrib/pg_plan_advice/expected/semijoin.out | 17 +++++++++++++++++
contrib/pg_plan_advice/pgpa_planner.c        | 28 ++++++++++++++++------------
contrib/pg_plan_advice/sql/semijoin.sql      |  9 +++++++++
3 files changed, 42 insertions(+), 12 deletions(-)



Message-ID: <E1wCIcf-000nmW-0a@gemulon.postgresql.org>
Permalink:  ../E1wCIcf-000nmW-0a@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1wCIcf-000nmW-0a@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: Fix a bug when a subquery is pruned away entirel
  In-Reply-To: <E1wCIcf-000nmW-0a@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox