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: Avoid creating a RESULT RTE that's marked LATERAL.
Date: Fri, 09 Jul 2021 17:38:34 +0000
Message-ID: <E1m1uSQ-0000ap-0v@gemulon.postgresql.org> (raw)

Avoid creating a RESULT RTE that's marked LATERAL.

Commit 7266d0997 added code to pull up simple constant function
results, converting the RTE_FUNCTION RTE to a dummy RTE_RESULT
RTE since it no longer need be scanned.  But I forgot to clear
the LATERAL flag if the RTE has it set.  If the function reduced
to a constant, it surely contains no lateral references so this
simplification is logically OK.  It's needed because various other
places will Assert that RESULT RTEs aren't LATERAL.

Per bug #17097 from Yaoguang Chen.  Back-patch to v13 where the
faulty code came in.

Discussion: https://postgr.es/m/17097-3372ef9f798fc94f@postgresql.org

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/9807b9aedc6e8b8a497db161b3d2d9f83648ea5b

Modified Files
--------------
src/backend/optimizer/prep/prepjointree.c | 5 ++++-
src/test/regress/expected/join.out        | 8 ++++++++
src/test/regress/sql/join.sql             | 3 +++
3 files changed, 15 insertions(+), 1 deletion(-)



view thread (3+ messages)  latest in thread

Message-ID: <E1m1uSQ-0000ap-0v@gemulon.postgresql.org>
Permalink:  ../E1m1uSQ-0000ap-0v@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1m1uSQ-0000ap-0v@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: Avoid creating a RESULT RTE that's marked LATERAL.
  In-Reply-To: <E1m1uSQ-0000ap-0v@gemulon.postgresql.org>
  References: <E1m1uSQ-0000ap-0v@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