@@ -350,29 +350,6 @@ set_plan_references(PlannerInfo *root, Plan *plan)
350350palloc0 (list_length (glob -> subplans )* sizeof (bool ));
351351}
352352
353- /* Also fix up the information in PartitionPruneInfos. */
354- foreach (lc ,root -> partPruneInfos )
355- {
356- PartitionPruneInfo * pruneinfo = lfirst (lc );
357- ListCell * l ;
358-
359- pruneinfo -> root_parent_relids =
360- offset_relid_set (pruneinfo -> root_parent_relids ,rtoffset );
361- foreach (l ,pruneinfo -> prune_infos )
362- {
363- List * prune_infos = lfirst (l );
364- ListCell * l2 ;
365-
366- foreach (l2 ,prune_infos )
367- {
368- PartitionedRelPruneInfo * pinfo = lfirst (l2 );
369-
370- /* RT index of the table to which the pinfo belongs. */
371- pinfo -> rtindex += rtoffset ;
372- }
373- }
374- }
375-
376353/* Now fix the Plan tree */
377354result = set_plan_refs (root ,plan ,rtoffset );
378355
@@ -1728,29 +1705,6 @@ set_customscan_references(PlannerInfo *root,
17281705cscan -> custom_relids = offset_relid_set (cscan -> custom_relids ,rtoffset );
17291706}
17301707
1731- /*
1732- * register_partpruneinfo
1733- *Subroutine for set_append_references and set_mergeappend_references
1734- *
1735- * Add the PartitionPruneInfo from root->partPruneInfos at the given index
1736- * into PlannerGlobal->partPruneInfos and return its index there.
1737- */
1738- static int
1739- register_partpruneinfo (PlannerInfo * root ,int part_prune_index )
1740- {
1741- PlannerGlobal * glob = root -> glob ;
1742- PartitionPruneInfo * pruneinfo ;
1743-
1744- Assert (part_prune_index >=0 &&
1745- part_prune_index < list_length (root -> partPruneInfos ));
1746- pruneinfo = list_nth_node (PartitionPruneInfo ,root -> partPruneInfos ,
1747- part_prune_index );
1748-
1749- glob -> partPruneInfos = lappend (glob -> partPruneInfos ,pruneinfo );
1750-
1751- return list_length (glob -> partPruneInfos )- 1 ;
1752- }
1753-
17541708/*
17551709 * set_append_references
17561710 *Do set_plan_references processing on an Append
@@ -1803,12 +1757,21 @@ set_append_references(PlannerInfo *root,
18031757
18041758aplan -> apprelids = offset_relid_set (aplan -> apprelids ,rtoffset );
18051759
1806- /*
1807- * Add PartitionPruneInfo, if any, to PlannerGlobal and update the index.
1808- */
1809- if (aplan -> part_prune_index >=0 )
1810- aplan -> part_prune_index =
1811- register_partpruneinfo (root ,aplan -> part_prune_index );
1760+ if (aplan -> part_prune_info )
1761+ {
1762+ foreach (l ,aplan -> part_prune_info -> prune_infos )
1763+ {
1764+ List * prune_infos = lfirst (l );
1765+ ListCell * l2 ;
1766+
1767+ foreach (l2 ,prune_infos )
1768+ {
1769+ PartitionedRelPruneInfo * pinfo = lfirst (l2 );
1770+
1771+ pinfo -> rtindex += rtoffset ;
1772+ }
1773+ }
1774+ }
18121775
18131776/* We don't need to recurse to lefttree or righttree ... */
18141777Assert (aplan -> plan .lefttree == NULL );
@@ -1870,12 +1833,21 @@ set_mergeappend_references(PlannerInfo *root,
18701833
18711834mplan -> apprelids = offset_relid_set (mplan -> apprelids ,rtoffset );
18721835
1873- /*
1874- * Add PartitionPruneInfo, if any, to PlannerGlobal and update the index.
1875- */
1876- if (mplan -> part_prune_index >=0 )
1877- mplan -> part_prune_index =
1878- register_partpruneinfo (root ,mplan -> part_prune_index );
1836+ if (mplan -> part_prune_info )
1837+ {
1838+ foreach (l ,mplan -> part_prune_info -> prune_infos )
1839+ {
1840+ List * prune_infos = lfirst (l );
1841+ ListCell * l2 ;
1842+
1843+ foreach (l2 ,prune_infos )
1844+ {
1845+ PartitionedRelPruneInfo * pinfo = lfirst (l2 );
1846+
1847+ pinfo -> rtindex += rtoffset ;
1848+ }
1849+ }
1850+ }
18791851
18801852/* We don't need to recurse to lefttree or righttree ... */
18811853Assert (mplan -> plan .lefttree == NULL );