Looking at 0001, I wonder if we should have a crosscheck that a PartitionPruneInfo you got from following an index is indeed constructed for the relation that you think it is: previously, you were always sure that the prune struct is for this node, because you followed a pointer that was set up in the node itself. Now you only have an index, and you have to trust that the index is correct.
I'm not sure how to implement this, or even if it's doable at all. Keeping the OID of the partitioned table in the PartitionPruneInfo struct is easy, but I don't know how to check it in ExecInitMergeAppend and ExecInitAppend. -- Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/ "Find a bug in a program, and fix it, and the program will work today. Show the program how to find and fix a bug, and the program will work forever" (Oliver Silfridge)