forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0c141fc
committed
Fix incorrect handling of join clauses pushed into parameterized paths.
In some cases a clause attached to an outer join can be pushed down intothe outer join's RHS even though the clause is not degenerate --- thiscan happen if we choose to make a parameterized path for the RHS. Ifthe clause ends up attached to a lower outer join, we'd misclassify itas being a "join filter" not a plain "filter" condition at that node,leading to wrong query results.To fix, teach extract_actual_join_clauses to examine each join clause'srequired_relids, not just its is_pushed_down flag. (The latter nowseems vestigial, or at least in need of rethinking, but we won't doanything so invasive as redefining it in a bug-fix patch.)This has been wrong since we introduced parameterized paths in 9.2,though it's evidently hard to hit given the lack of previous reports.The test case used here involves a lateral function call, and I thinkthat a lateral reference may be required to get the planner to selecta broken plan; though I wouldn't swear to that. In any case, even ifLATERAL is needed to trigger the bug, it still affects all supportedbranches, so back-patch to all.Per report from Andreas Karlsson. Thanks to Andrew Gierth forpreliminary investigation.Discussion:https://postgr.es/m/f8128b11-c5bf-3539-48cd-234178b2314d@proxel.se1 parentb3f4742 commit0c141fc
File tree
5 files changed
+52
-1
lines changed- src
- backend/optimizer
- plan
- util
- include/optimizer
- test/regress
- expected
- sql
5 files changed
+52
-1
lines changedLines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3447 | 3447 |
| |
3448 | 3448 |
| |
3449 | 3449 |
| |
| 3450 | + | |
3450 | 3451 |
| |
3451 | 3452 |
| |
3452 | 3453 |
| |
| |||
3559 | 3560 |
| |
3560 | 3561 |
| |
3561 | 3562 |
| |
| 3563 | + | |
3562 | 3564 |
| |
3563 | 3565 |
| |
3564 | 3566 |
| |
| |||
3852 | 3854 |
| |
3853 | 3855 |
| |
3854 | 3856 |
| |
| 3857 | + | |
3855 | 3858 |
| |
3856 | 3859 |
| |
3857 | 3860 |
| |
|
Lines changed: 10 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
418 | 418 |
| |
419 | 419 |
| |
420 | 420 |
| |
| 421 | + | |
421 | 422 |
| |
422 | 423 |
| |
423 | 424 |
| |
| |||
432 | 433 |
| |
433 | 434 |
| |
434 | 435 |
| |
435 |
| - | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
436 | 445 |
| |
437 | 446 |
| |
438 | 447 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
| 39 | + | |
39 | 40 |
| |
40 | 41 |
| |
41 | 42 |
| |
|
Lines changed: 27 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3349 | 3349 |
| |
3350 | 3350 |
| |
3351 | 3351 |
| |
| 3352 | + | |
| 3353 | + | |
| 3354 | + | |
| 3355 | + | |
| 3356 | + | |
| 3357 | + | |
| 3358 | + | |
| 3359 | + | |
| 3360 | + | |
| 3361 | + | |
| 3362 | + | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
| 3367 | + | |
| 3368 | + | |
| 3369 | + | |
| 3370 | + | |
| 3371 | + | |
| 3372 | + | |
| 3373 | + | |
| 3374 | + | |
| 3375 | + | |
| 3376 | + | |
| 3377 | + | |
| 3378 | + | |
3352 | 3379 |
| |
3353 | 3380 |
| |
3354 | 3381 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1019 | 1019 |
| |
1020 | 1020 |
| |
1021 | 1021 |
| |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
1022 | 1033 |
| |
1023 | 1034 |
| |
1024 | 1035 |
| |
|
0 commit comments
Comments
(0)