Re: postgres_fdw: wrong results with self join + enable_nestloop off

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Nishant Sharma <nishant(dot)sharma(at)enterprisedb(dot)com>
Cc: Suraj Kharage <suraj(dot)kharage(at)enterprisedb(dot)com>, Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: postgres_fdw: wrong results with self join + enable_nestloop off
Date: 2023-06-05 03:09:12
Message-ID: CAMbWs4-8huBA2ZzxMxYL85=c=LMnK7W95XD+XSeKwQmkXacQFg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 2, 2023 at 8:31 PM Nishant Sharma <
nishant(dot)sharma(at)enterprisedb(dot)com> wrote:

> *I only had a minor comment on below change:-*
>
>
>
>
>
> *- gating_clauses = get_gating_quals(root, scan_clauses);+ if
> (best_path->pathtype == T_ForeignScan && IS_JOIN_REL(rel))+
> gating_clauses = get_gating_quals(root, ((ForeignPath *)
> best_path)->joinrestrictinfo);+ else+ gating_clauses =
> get_gating_quals(root, scan_clauses);*
>
> Instead of using 'if' and creating a special case here can't we do
> something in the above switch?
>

I thought about that too. IIRC I did not do it in that way because
postgresGetForeignPlan expects that there is no scan_clauses for a join
rel. So doing that would trigger the Assert there.

/*
* For a join rel, baserestrictinfo is NIL and we are not considering
* parameterization right now, so there should be no scan_clauses for
* a joinrel or an upper rel either.
*/
Assert(!scan_clauses);

Thanks
Richard

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message jiye 2023-06-05 03:30:48 confusion about this commit "Revert "Skip redundant anti-wraparound vacuums""
Previous Message Richard Guo 2023-06-05 03:06:11 Re: postgres_fdw: wrong results with self join + enable_nestloop off