Temporary hack to unbreak partitionwise join control.
authorRobert Haas <[email protected]>
Wed, 29 Oct 2025 19:17:46 +0000 (15:17 -0400)
committerRobert Haas <[email protected]>
Thu, 6 Nov 2025 16:41:59 +0000 (11:41 -0500)
commit97e540b19d8ffe2329fb59436f1ce64a6d6e58f1
tree28a6904d6e24df887772c6957b818dbdcc70cc68
parent0bc729a60c1e4220564ebef714356240695d0486
Temporary hack to unbreak partitionwise join control.

Resetting the pathlist and partial pathlist to NIL when the
topmost scan/join rel is a partitioned joinrel is incorrect. The issue
was originally reported by Ashutosh Bapat here:

http://postgr.es/m/CAExHW5toze58+jL-454J3ty11sqJyU13Sz5rJPQZDmASwZgWiA@mail.gmail.com

I failed to understand Ashutosh's explanation until I hit the problem
myself, so here's my attempt to re-explain what he had said, just in
case you find my explanation any clearer:

http://postgr.es/m/CA%2BTgmoZvBD%2B5vyQruXBVXW74FMgWxE%3DO4K4rCrCtEELWNj-MLA%40mail.gmail.com

As subsequent discussion on that thread indicates, it is unclear
exactly what the right fix for this problem is, and at least as of
this writing, it is even more unclear how to adjust the test cases
that break. What I've done here is just accept all the changes to the
regression test outputs, which is almost certainly the wrong idea,
especially since I've also added no comments.

This is just a temporary hack to make it possible to test this patch
set, because without this, PARTITIONWISE() advice can't be used to
suppress a partitionwise join, because all of the alternatives get
eliminated regardless of cost.
src/backend/optimizer/plan/planner.c
src/test/regress/expected/partition_join.out
src/test/regress/expected/subselect.out