I think we need an ANALYZE here in case the statistics gets updated while DETACH and ATTACH is going on. Other testcases also need to be updated with ANALYZE, including the negative one.
Done.
+-- partition-wise join can not be applied if the only one of joining table have
Correction: ... if only one of the joining tables has ...
Done.
Please add the patch to the next commitfest so that it's not forgotten.
I think we can get rid of the multi-level partition-wise testcase as well. Also, since we are re-attaching existing partition tables as default partitions, we don't need to check the output as well; just plan should be enough.