Re: postgres_fdw bug in 9.6
Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
From: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
To: Etsuro Fujita <fujita.etsuro@lab.ntt.co.jp>
Cc: Jeff Janes <jeff.janes@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>, Robert Haas <robertmhaas@gmail.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2017-01-10T12:15:22Z
Lists: pgsql-hackers
> >> If the inner and/or outer paths are not ordered as required, we will need >> to >> order them. Code below doesn't seem to handle that case. >> /* >> * If the paths are already well enough ordered, we >> can >> * skip doing an explicit sort. >> */ >> if (outerkeys && >> pathkeys_contained_in(outerkeys, >> outer_path->pathkeys)) >> outerkeys = NIL; >> if (innerkeys && >> pathkeys_contained_in(innerkeys, >> inner_path->pathkeys)) >> innerkeys = NIL; > > > I might be missing something, but if the outer/inner paths are already well > sorted, we wouldn't need an explicit sort, so we can set the > outerkeys/innerkeys to NIL safely. (You can find the same optimization in > try_mergejoin_path.) Actually I didn't notice that create_mergejoin_path saves those keys in the MergePath and then adds sorting steps during planning. Sorry for the trouble. Another concern here is that we are copying pieces of logic in add_paths_to_joinrel() without arranging it as neatly as in that function. -- Best Wishes, Ashutosh Bapat EnterpriseDB Corporation The Postgres Database Company
Commits
-
Fix test case for 'outer pathkeys do not match mergeclauses' fix.
- d397f558d555 9.6.7 landed
- 92123c6ea212 10.2 landed
- 99f6a17dd62a 11.0 landed
-
postgres_fdw: Avoid 'outer pathkeys do not match mergeclauses' error.
- 4a81c022975e 9.6.7 landed
- 3f05a30b50a7 10.2 landed
- 4bbf6edfbd5d 11.0 landed
-
postgres_fdw: Consider foreign joining and foreign sorting together.
- aa09cd242fa7 9.6.0 cited
-
Allow foreign and custom joins to handle EvalPlanQual rechecks.
- 385f337c9f39 9.6.0 cited
-
Allow FDWs to push down quals without breaking EvalPlanQual rechecks.
- 5fc4c26db512 9.6.0 cited