forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6742718
Fix some issues with wrong placement of pseudo-constant quals.
initsplan.c figured that it could push Var-free qual clauses tothe top of the current JoinDomain, which is okay in the abstract.But if the current domain is inside some outer join, and we latercommute an inside-the-domain outer join with one outside it,we end up placing the pushed-up qual clause incorrectly.In distribute_qual_to_rels, avoid this by using the syntactic scopeof the qual clause; with the exception that if we're in the top-leveljoin domain we can still use the full query relid set, ensuring theresulting gating Result node goes to the top of the plan. (This isapproximately as smart as the pre-v16 code was. Perhaps we can dobetter later, but it's not clear that such cases are worth a lot ofsweat.)In process_implied_equality, we don't have a clear notion of syntacticscope, but we do have the results of SpecialJoinInfo construction.Thumb through those and remove any lower outer joins that might getcommuted to above the join domain. Again, we can make an exceptionfor the top-level join domain. It'd be possible to work harder here(for example, by keeping outer joins that aren't shown as potentiallycommutable), but I'm going to stop here for the moment. This issuehas convinced me that the current representation of join domainsprobably needs further refinement, so I'm disinclined to writeinessential dependent logic just yet.In passing, tighten the qualscope passed to process_implied_equalityby generate_base_implied_equalities_no_const; there's no need forit to be larger than the rel we are currently considering.Tom Lane and Richard Guo, per report from Tender Wang.Discussion:https://postgr.es/m/CAHewXNk9eJ35ru5xATWioTV4+xZPHptjy9etdcNPjUfY9RQ+uQ@mail.gmail.com1 parent31c35cd commit6742718
File tree
4 files changed
+155
-9
lines changed- src
- backend/optimizer
- path
- plan
- test/regress
- expected
- sql
4 files changed
+155
-9
lines changedLines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1248 | 1248 |
| |
1249 | 1249 |
| |
1250 | 1250 |
| |
1251 |
| - | |
| 1251 | + | |
1252 | 1252 |
| |
1253 | 1253 |
| |
1254 | 1254 |
| |
1255 |
| - | |
| 1255 | + | |
1256 | 1256 |
| |
1257 | 1257 |
| |
1258 | 1258 |
| |
|
Lines changed: 67 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
125 | 125 |
| |
126 | 126 |
| |
127 | 127 |
| |
| 128 | + | |
128 | 129 |
| |
129 | 130 |
| |
130 | 131 |
| |
| |||
2250 | 2251 |
| |
2251 | 2252 |
| |
2252 | 2253 |
| |
2253 |
| - | |
2254 |
| - | |
| 2254 | + | |
2255 | 2255 |
| |
2256 | 2256 |
| |
2257 | 2257 |
| |
| |||
2269 | 2269 |
| |
2270 | 2270 |
| |
2271 | 2271 |
| |
2272 |
| - | |
2273 |
| - | |
| 2272 | + | |
| 2273 | + | |
| 2274 | + | |
| 2275 | + | |
| 2276 | + | |
| 2277 | + | |
| 2278 | + | |
| 2279 | + | |
| 2280 | + | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
2274 | 2285 |
| |
2275 | 2286 |
| |
2276 | 2287 |
| |
| |||
2734 | 2745 |
| |
2735 | 2746 |
| |
2736 | 2747 |
| |
2737 |
| - | |
| 2748 | + | |
| 2749 | + | |
2738 | 2750 |
| |
2739 | 2751 |
| |
2740 | 2752 |
| |
2741 |
| - | |
2742 |
| - | |
| 2753 | + | |
| 2754 | + | |
2743 | 2755 |
| |
2744 | 2756 |
| |
2745 | 2757 |
| |
| |||
2856 | 2868 |
| |
2857 | 2869 |
| |
2858 | 2870 |
| |
| 2871 | + | |
| 2872 | + | |
| 2873 | + | |
| 2874 | + | |
| 2875 | + | |
| 2876 | + | |
| 2877 | + | |
| 2878 | + | |
| 2879 | + | |
| 2880 | + | |
| 2881 | + | |
| 2882 | + | |
| 2883 | + | |
| 2884 | + | |
| 2885 | + | |
| 2886 | + | |
| 2887 | + | |
| 2888 | + | |
| 2889 | + | |
| 2890 | + | |
| 2891 | + | |
| 2892 | + | |
| 2893 | + | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + | |
| 2897 | + | |
| 2898 | + | |
| 2899 | + | |
| 2900 | + | |
| 2901 | + | |
| 2902 | + | |
| 2903 | + | |
| 2904 | + | |
| 2905 | + | |
| 2906 | + | |
| 2907 | + | |
| 2908 | + | |
| 2909 | + | |
| 2910 | + | |
| 2911 | + | |
| 2912 | + | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
2859 | 2919 |
| |
2860 | 2920 |
| |
2861 | 2921 |
| |
|
Lines changed: 61 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5119 | 5119 |
| |
5120 | 5120 |
| |
5121 | 5121 |
| |
| 5122 | + | |
| 5123 | + | |
| 5124 | + | |
| 5125 | + | |
| 5126 | + | |
| 5127 | + | |
| 5128 | + | |
| 5129 | + | |
| 5130 | + | |
| 5131 | + | |
| 5132 | + | |
| 5133 | + | |
| 5134 | + | |
| 5135 | + | |
| 5136 | + | |
| 5137 | + | |
| 5138 | + | |
| 5139 | + | |
| 5140 | + | |
| 5141 | + | |
| 5142 | + | |
| 5143 | + | |
| 5144 | + | |
| 5145 | + | |
| 5146 | + | |
| 5147 | + | |
| 5148 | + | |
| 5149 | + | |
| 5150 | + | |
| 5151 | + | |
| 5152 | + | |
| 5153 | + | |
| 5154 | + | |
| 5155 | + | |
| 5156 | + | |
| 5157 | + | |
| 5158 | + | |
| 5159 | + | |
| 5160 | + | |
| 5161 | + | |
| 5162 | + | |
| 5163 | + | |
| 5164 | + | |
| 5165 | + | |
| 5166 | + | |
| 5167 | + | |
| 5168 | + | |
| 5169 | + | |
| 5170 | + | |
| 5171 | + | |
| 5172 | + | |
| 5173 | + | |
| 5174 | + | |
| 5175 | + | |
| 5176 | + | |
| 5177 | + | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
| 5182 | + | |
5122 | 5183 |
| |
5123 | 5184 |
| |
5124 | 5185 |
| |
|
Lines changed: 25 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1846 | 1846 |
| |
1847 | 1847 |
| |
1848 | 1848 |
| |
| 1849 | + | |
| 1850 | + | |
| 1851 | + | |
| 1852 | + | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
| 1857 | + | |
| 1858 | + | |
| 1859 | + | |
| 1860 | + | |
| 1861 | + | |
| 1862 | + | |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
1849 | 1874 |
| |
1850 | 1875 |
| |
1851 | 1876 |
| |
|
0 commit comments
Comments
(0)