Commit 3af8773
committed
Fix another cause of "wrong varnullingrels" planner failures.
I removed the delay_upper_joins mechanism in commit b448f1c,
reasoning that it was only needed when we have a single-table
(SELECT ... WHERE) as the immediate RHS child of a left join,
and we could get rid of that by hoisting the WHERE condition into
the parent join's quals. However that new code missed a case:
we could have "foo LEFT JOIN ((SELECT ... WHERE) LEFT JOIN bar)",
and if the two left joins can be commuted then we now have the
problematic query shape. We can fix this too easily enough,
by allowing the syntactically-lower left join to pass through
its parent qual location pointer recursively. That lets
prepjointree.c discard the SELECT by temporarily hoisting the
WHERE condition into the ancestor join's qual.
Per bug #17978 from Zuming Jiang.
Discussion: https://postgr.es/m/17978-12f3d93a55297266@postgresql.org1 parent efeb12e commit 3af8773
File tree
3 files changed
+51
-7
lines changed- src
- backend/optimizer/prep
- test/regress
- expected
- sql
3 files changed
+51
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3213 | 3213 | | |
3214 | 3214 | | |
3215 | 3215 | | |
| 3216 | + | |
| 3217 | + | |
3216 | 3218 | | |
3217 | 3219 | | |
3218 | 3220 | | |
| |||
3316 | 3318 | | |
3317 | 3319 | | |
3318 | 3320 | | |
3319 | | - | |
3320 | | - | |
3321 | | - | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
3322 | 3331 | | |
3323 | 3332 | | |
3324 | 3333 | | |
3325 | | - | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
3326 | 3337 | | |
3327 | 3338 | | |
3328 | 3339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2531 | 2531 | | |
2532 | 2532 | | |
2533 | 2533 | | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
2534 | 2558 | | |
2535 | 2559 | | |
2536 | 2560 | | |
2537 | 2561 | | |
2538 | 2562 | | |
2539 | 2563 | | |
2540 | | - | |
| 2564 | + | |
2541 | 2565 | | |
2542 | 2566 | | |
2543 | 2567 | | |
2544 | 2568 | | |
2545 | 2569 | | |
2546 | | - | |
2547 | | - | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
2548 | 2573 | | |
2549 | 2574 | | |
2550 | 2575 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
505 | 513 | | |
506 | 514 | | |
507 | 515 | | |
| |||
0 commit comments