Re: postgres_fdw: wrong results with self join + enable_nestloop off
Etsuro Fujita <etsuro.fujita@gmail.com>
From: Etsuro Fujita <etsuro.fujita@gmail.com>
To: Önder Kalacı <onderkalaci@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>, Nishant Sharma <nishant.sharma@enterprisedb.com>, Suraj Kharage <suraj.kharage@enterprisedb.com>, pgsql-hackers@postgresql.org
Date: 2023-08-16T09:22:31Z
Lists: pgsql-hackers
Hi, On Tue, Aug 15, 2023 at 11:02 PM Önder Kalacı <onderkalaci@gmail.com> wrote: > The commit[1] seems to break some queries in Citus[2], which is an extension which relies on set_join_pathlist_hook. > > Although the comment says /*Finally, give extensions a chance to manipulate the path list.*/ we use it to extract lots of information about the joins and do the planning based on the information. > > Now, for some joins where consider_join_pushdown=false, we cannot get the information that we used to get, which prevents doing distributed planning for certain queries. > > We wonder if it is possible to allow extensions to access the join info under all circumstances, as it used to be? Basically, removing the additional check: > > diff --git a/src/backend/optimizer/path/joinpath.c b/src/backend/optimizer/path/joinpath.c > index 03b3185984..080e76cbe9 100644 > --- a/src/backend/optimizer/path/joinpath.c > +++ b/src/backend/optimizer/path/joinpath.c > @@ -349,8 +349,7 @@ add_paths_to_joinrel(PlannerInfo *root, > /* > * 6. Finally, give extensions a chance to manipulate the path list. > */ > - if (set_join_pathlist_hook && > - consider_join_pushdown) > + if (set_join_pathlist_hook) > set_join_pathlist_hook(root, joinrel, outerrel, innerrel, > jointype, &extra); Maybe we could do so by leaving to extensions the decision whether they replace joins with pseudoconstant clauses, but I am not sure that that is a good idea, because that would require the authors to modify and recompile their extensions to fix the issue... So I fixed the core side. I am not familiar with the Citus extension, but such pseudoconstant clauses are handled within the Citus extension? Thanks for the report! Best regards, Etsuro Fujita
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Re-allow FDWs and custom scan providers to replace joins with pseudoconstant quals.
- 9e9931d2bf40 17.0 landed
-
Disallow replacing joins with scans in problematic cases.
- db01f26968f2 11.21 landed
- 9edf72aa7644 12.16 landed
- 730f983effa5 13.12 landed
- b0e390e6d1d6 14.9 landed
- d1ef5631e620 15.4 landed
- 695f5deb7902 16.0 landed
- 6f80a8d9c137 17.0 landed
-
doc: PQinitOpenSSL and PQinitSSL are obsolete in OpenSSL 1.1.0+
- 928e05ddfd40 16.0 cited