PFA patch which takes care of some of the TODOs mentioned in my previous mail. The patch is based on the set of patches supporting declarative partitioning by Amit Langoted posted on 26th August.
I have applied declarative partitioning patches posted by Amit Langote on 26 Aug 2016 and then latest partition-wise-join patch, getting below error while make install.