forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit8538519
committed
Fix thinko in outer-join removal.
If we have a RestrictInfo that mentions both the removal-candidaterelation and the outer join's relid, then that is a pushed-downcondition not a join condition, so it should be grounds for decidingthat we can't remove the outer join. In commit2489d76, I'd blindlyincluded the OJ's relid into "joinrelids" as per the new standardconvention, but the checks of attr_needed and ph_needed should onlyallow the join's input rels to be mentioned.Having done that, the check for references in pushed-down qualsa few lines further down should be redundant. I left it in placeas an Assert, though.While researching this I happened across a couple of comments thatworried about the effects of update_placeholder_eval_levels.That's gone as ofb448f1c, so we can remove some worry.Per bug #17769 from Robins Tharakan. The submitted test casetriggers this more or less accidentally because we flatten outa LATERAL sub-select after we've done join strength reduction;if we did that in the other order, this problem would be maskedbecause the outer join would get simplified to an inner join.To ensure that the committed test case will continue to testwhat it means to even if we make that happen someday, use atest clause involving COALESCE(), which will prevent us fromusing it to do join strength reduction.Patch by me, but thanks to Richard Guo for initial investigation.Discussion:https://postgr.es/m/17769-e4f7a5c9d84a80a7@postgresql.org1 parent5840c20 commit8538519
File tree
5 files changed
+39
-29
lines changed- src
- backend/optimizer
- plan
- util
- test/regress
- expected
- sql
5 files changed
+39
-29
lines changedLines changed: 14 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
164 | 164 |
| |
165 | 165 |
| |
166 | 166 |
| |
| 167 | + | |
167 | 168 |
| |
168 | 169 |
| |
169 | 170 |
| |
| |||
190 | 191 |
| |
191 | 192 |
| |
192 | 193 |
| |
193 |
| - | |
194 |
| - | |
195 |
| - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
196 | 198 |
| |
197 | 199 |
| |
198 | 200 |
| |
199 |
| - | |
200 |
| - | |
201 |
| - | |
202 |
| - | |
203 |
| - | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
204 | 204 |
| |
205 | 205 |
| |
206 | 206 |
| |
| |||
211 | 211 |
| |
212 | 212 |
| |
213 | 213 |
| |
214 |
| - | |
| 214 | + | |
215 | 215 |
| |
216 | 216 |
| |
217 | 217 |
| |
| |||
230 | 230 |
| |
231 | 231 |
| |
232 | 232 |
| |
233 |
| - | |
| 233 | + | |
234 | 234 |
| |
235 | 235 |
| |
236 | 236 |
| |
| |||
273 | 273 |
| |
274 | 274 |
| |
275 | 275 |
| |
276 |
| - | |
277 |
| - | |
278 |
| - | |
| 276 | + | |
| 277 | + | |
279 | 278 |
| |
280 |
| - | |
281 |
| - | |
282 |
| - | |
| 279 | + | |
| 280 | + | |
283 | 281 |
| |
284 | 282 |
| |
285 | 283 |
| |
|
Lines changed: 3 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
494 | 494 |
| |
495 | 495 |
| |
496 | 496 |
| |
497 |
| - | |
498 |
| - | |
499 |
| - | |
500 | 497 |
| |
501 | 498 |
| |
502 | 499 |
| |
| |||
509 | 506 |
| |
510 | 507 |
| |
511 | 508 |
| |
| 509 | + | |
| 510 | + | |
| 511 | + | |
512 | 512 |
| |
513 | 513 |
| |
514 | 514 |
| |
|
Lines changed: 0 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
198 | 198 |
| |
199 | 199 |
| |
200 | 200 |
| |
201 |
| - | |
202 |
| - | |
203 |
| - | |
204 |
| - | |
205 |
| - | |
206 |
| - | |
207 |
| - | |
208 |
| - | |
209 |
| - | |
210 |
| - | |
211 | 201 |
| |
212 | 202 |
| |
213 | 203 |
| |
|
Lines changed: 15 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5150 | 5150 |
| |
5151 | 5151 |
| |
5152 | 5152 |
| |
| 5153 | + | |
| 5154 | + | |
| 5155 | + | |
| 5156 | + | |
| 5157 | + | |
| 5158 | + | |
| 5159 | + | |
| 5160 | + | |
| 5161 | + | |
| 5162 | + | |
| 5163 | + | |
| 5164 | + | |
| 5165 | + | |
| 5166 | + | |
| 5167 | + | |
5153 | 5168 |
| |
5154 | 5169 |
| |
5155 | 5170 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1860 | 1860 |
| |
1861 | 1861 |
| |
1862 | 1862 |
| |
| 1863 | + | |
| 1864 | + | |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
1863 | 1870 |
| |
1864 | 1871 |
| |
1865 | 1872 |
| |
|
0 commit comments
Comments
(0)