@@ -350,29 +350,6 @@ set_plan_references(PlannerInfo *root, Plan *plan)
350
350
palloc0 (list_length (glob -> subplans )* sizeof (bool ));
351
351
}
352
352
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
-
376
353
/* Now fix the Plan tree */
377
354
result = set_plan_refs (root ,plan ,rtoffset );
378
355
@@ -1728,29 +1705,6 @@ set_customscan_references(PlannerInfo *root,
1728
1705
cscan -> custom_relids = offset_relid_set (cscan -> custom_relids ,rtoffset );
1729
1706
}
1730
1707
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
-
1754
1708
/*
1755
1709
* set_append_references
1756
1710
*Do set_plan_references processing on an Append
@@ -1803,12 +1757,21 @@ set_append_references(PlannerInfo *root,
1803
1757
1804
1758
aplan -> apprelids = offset_relid_set (aplan -> apprelids ,rtoffset );
1805
1759
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
+ }
1812
1775
1813
1776
/* We don't need to recurse to lefttree or righttree ... */
1814
1777
Assert (aplan -> plan .lefttree == NULL );
@@ -1870,12 +1833,21 @@ set_mergeappend_references(PlannerInfo *root,
1870
1833
1871
1834
mplan -> apprelids = offset_relid_set (mplan -> apprelids ,rtoffset );
1872
1835
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
+ }
1879
1851
1880
1852
/* We don't need to recurse to lefttree or righttree ... */
1881
1853
Assert (mplan -> plan .lefttree == NULL );