Thread: pgsql: Don't constrain self-join removal due to PHVs

pgsql: Don't constrain self-join removal due to PHVs

From
Alexander Korotkov
Date:
Don't constrain self-join removal due to PHVs

Self-join removal appears to be safe to apply with placeholder variables
as long as we handle PlaceHolderVar in replace_varno_walker() and replace
relid in phinfo->ph_lateral.

Discussion: https://postgr.es/m/18187-831da249cbd2ff8e%40postgresql.org
Author: Richard Guo
Reviewed-by: Andrei Lepikhov

Branch
------
master

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

Modified Files
--------------
src/backend/optimizer/plan/analyzejoins.c | 18 ++++----------
src/test/regress/expected/join.out        | 39 ++++++++++++++++++++++---------
src/test/regress/sql/join.sql             | 10 +++++---
3 files changed, 39 insertions(+), 28 deletions(-)