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

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

On Mon, Jun 5, 2023 at 9:19 PM Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
wrote:

> If the patch is intended for HEAD only, I also think it goes in the
> right direction. But if it is intended for back branches as well, I
> do not think so, because it would cause ABI breakage due to changes
> made to the ForeignPath struct and the create_foreign_join_path() API.
> (For the former, I think we could avoid doing so by adding the new
> member at the end of the struct, not in the middle, though.)

Thanks for pointing this out. You're right. The patch has backport
issue because of the ABI breakage. So it can only be applied on HEAD.

> To avoid this issue, I am wondering if we should modify
> add_paths_to_joinrel() in back branches so that it just disallows the
> FDW to consider pushing down joins when the restrictlist has
> pseudoconstant clauses. Attached is a patch for that.

I think we can do that in back branches. But I'm a little concerned
that we'd miss a better plan if FDW cannot push down joins in such
cases. I may be worrying over nothing though if it's not common that
the restrictlist has pseudoconstant clauses.

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-06-06 04:06:33 Re: Implement generalized sub routine find_in_log for tap test
Previous Message Vik Fearing 2023-06-06 03:13:52 Add support for AT LOCAL