pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Avoid creating a RESULT RTE that's marked LATERAL. 3+ messages / 1 participants [nested] [flat]
* pgsql: Avoid creating a RESULT RTE that's marked LATERAL. @ 2021-07-09 17:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2021-07-09 17:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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 ------ master Details ------- https://git.postgresql.org/pg/commitdiff/d23ac62afa646b7073a7f0db0a137308459a263b 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(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Avoid creating a RESULT RTE that's marked LATERAL. @ 2021-07-09 17:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2021-07-09 17:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/1d98fdaed89c00465ef68fa2804967ea27b03abc 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(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: Avoid creating a RESULT RTE that's marked LATERAL. @ 2021-07-09 17:38 Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 3+ messages in thread From: Tom Lane @ 2021-07-09 17:38 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org 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(-) ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-07-09 17:38 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-07-09 17:38 pgsql: Avoid creating a RESULT RTE that's marked LATERAL. Tom Lane <tgl@sss.pgh.pa.us> 2021-07-09 17:38 pgsql: Avoid creating a RESULT RTE that's marked LATERAL. Tom Lane <tgl@sss.pgh.pa.us> 2021-07-09 17:38 pgsql: Avoid creating a RESULT RTE that's marked LATERAL. Tom Lane <tgl@sss.pgh.pa.us>
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