pgsql: Avoid creating a RESULT RTE that's marked LATERAL.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Avoid creating a RESULT RTE that's marked LATERAL.
Date: 2021-07-09 17:38:34
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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/[email protected]

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

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-07-09 18:16:01 pgsql: Un-break AIX build.
Previous Message Tom Lane 2021-07-09 16:39:20 pgsql: Update configure's probe for libldap to work with OpenLDAP 2.5.