pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Remove bogus Assert and dead code in remove_useless_results_recu
Date: Tue, 29 Nov 2022 15:52:59 +0000
Message-ID: <E1p02uo-001JQ0-I4@gemulon.postgresql.org> (raw)

Remove bogus Assert and dead code in remove_useless_results_recurse().

The JOIN_SEMI case Assert'ed that there are no PlaceHolderVars that
need to be evaluated at the semijoin's RHS, which is wrong because
there could be some in the semijoin's qual condition.  However, there
could not be any references further up than that, and within the qual
there is not any way that such a PHV could have gone to null yet, so
we don't really need the PHV and there is no need to avoid making the
RHS-removal optimization.  The upshot is that there's no actual bug
in production code, and we ought to just remove this misguided Assert.

While we're here, also drop the JOIN_RIGHT case, which is dead code
because reduce_outer_joins() already got rid of JOIN_RIGHT.

Per bug #17700 from Xin Wen.  Uselessness of the JOIN_RIGHT case
pointed out by Richard Guo.  Back-patch to v12 where this code
was added.

Discussion: https://postgr.es/m/17700-2b5c10d917c30687@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/aca695fb6847638538833821ebab8a62d51c4549

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c | 24 +++++++++---------------
src/test/regress/expected/join.out        | 20 ++++++++++++++++++++
src/test/regress/sql/join.sql             | 10 ++++++++++
3 files changed, 39 insertions(+), 15 deletions(-)



view thread (5+ messages)  latest in thread

Message-ID: <E1p02uo-001JQ0-I4@gemulon.postgresql.org>
Permalink:  ../E1p02uo-001JQ0-I4@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1p02uo-001JQ0-I4@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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Remove bogus Assert and dead code in remove_useless_results_recu
  In-Reply-To: <E1p02uo-001JQ0-I4@gemulon.postgresql.org>
  References: <E1p02uo-001JQ0-I4@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