pgsql: postgres_fdw: Avoid pulling up restrict infos from subqueries

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: postgres_fdw: Avoid pulling up restrict infos from subqueries
Date: 2025-03-25 03:51:21
Message-ID: E1twvJx-000rVP-1W@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

postgres_fdw: Avoid pulling up restrict infos from subqueries

Semi-join joins below left/right join are deparsed as
subqueries. Thus, we can't refer to subqueries vars from upper relations.
This commit avoids pulling conditions from them.

Reported-by: Robins Tharakan <tharakan(at)gmail(dot)com>
Bug: #18852
Discussion: https://postgr.es/m/CAEP4nAzryLd3gwcUpFBAG9MWyDfMRX8ZjuyY2XXjyC_C6k%2B_Zw%40mail.gmail.com
Author: Alexander Pyhalov <a(dot)pyhalov(at)postgrespro(dot)ru>
Reviewed-by: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Backpatch-through: 17

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/023fb512755ffb64949eb6de8464c259ca70f1bd

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 38 ++++++++++++++++++++++++++
contrib/postgres_fdw/postgres_fdw.c | 32 ++++++++++++++++------
contrib/postgres_fdw/sql/postgres_fdw.sql | 17 ++++++++++++
3 files changed, 79 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2025-03-25 04:09:10 pgsql: Fix an oversight in 3abe9dc188.
Previous Message Alexander Korotkov 2025-03-25 03:51:20 pgsql: postgres_fdw: Avoid pulling up restrict infos from subqueries