- Notifications
You must be signed in to change notification settings - Fork28
Commitcd1f0d0
committed
Fix thinko in previous patch for optimizing EXISTS-within-EXISTS.
When recursing after an optimization in pull_up_sublinks_qual_recurse, theavailable_rels value passed down must include only the relations that arein the righthand side of the new SEMI or ANTI join; it's incorrect to pullup a sub-select that refers to other relations, as seen in the added testcase. Per report from BangarRaju Vadapalli.While at it, rethink the idea of recursing below a NOT EXISTS. That isessentially the same situation as pulling up ANY/EXISTS sub-selects thatare in the ON clause of an outer join, and it has the same disadvantage:we'd force the two joins to be evaluated according to the syntactic nestingorder, because the lower join will most likely not be able to commute withthe ANTI join. That could result in having to form a rather large joinproduct, whereas the handling of a correlated subselect is not quite thatdumb. So until we can handle those cases better, #ifdef NOT_USED thatcase. (I think it's okay to pull up in the EXISTS/ANY cases, because SEMIjoins aren't so inflexible about ordering.)Back-patch to 8.4, same as for previous patch in this area. Fortunatelythat patch hadn't made it into any shipped releases yet.1 parenta40a5d9 commitcd1f0d0
File tree
3 files changed
+37
-10
lines changed- src
- backend/optimizer/prep
- test/regress
- expected
- sql
3 files changed
+37
-10
lines changedLines changed: 16 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
246 | 246 |
| |
247 | 247 |
| |
248 | 248 |
| |
| 249 | + | |
249 | 250 |
| |
250 | 251 |
| |
251 | 252 |
| |
| |||
331 | 332 |
| |
332 | 333 |
| |
333 | 334 |
| |
334 |
| - | |
335 |
| - | |
336 |
| - | |
| 335 | + | |
337 | 336 |
| |
338 | 337 |
| |
339 | 338 |
| |
| |||
355 | 354 |
| |
356 | 355 |
| |
357 | 356 |
| |
358 |
| - | |
359 |
| - | |
360 |
| - | |
| 357 | + | |
361 | 358 |
| |
362 | 359 |
| |
363 | 360 |
| |
| |||
377 | 374 |
| |
378 | 375 |
| |
379 | 376 |
| |
380 |
| - | |
381 | 377 |
| |
382 | 378 |
| |
383 | 379 |
| |
| |||
387 | 383 |
| |
388 | 384 |
| |
389 | 385 |
| |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
390 | 395 |
| |
| 396 | + | |
| 397 | + | |
391 | 398 |
| |
392 | 399 |
| |
393 | 400 |
| |
394 |
| - | |
395 |
| - | |
396 |
| - | |
| 401 | + | |
397 | 402 |
| |
398 | 403 |
| |
399 | 404 |
| |
400 | 405 |
| |
| 406 | + | |
401 | 407 |
| |
402 | 408 |
| |
403 | 409 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
530 | 530 |
| |
531 | 531 |
| |
532 | 532 |
| |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + |
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
341 | 341 |
| |
342 | 342 |
| |
343 | 343 |
| |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + |
0 commit comments
Comments
(0)