forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6f80a8d

Etsuro Fujita
Disallow replacing joins with scans in problematic cases.
Commite7cb7ee, which introduced the infrastructure for FDWs andcustom scan providers to replace joins with scans, failed to add supporthandling of pseudoconstant quals assigned to replaced joins increateplan.c, leading to an incorrect plan without a gating Result nodewhen postgres_fdw replaced a join with such a qual.To fix, we could add the support by 1) modifying the ForeignPath andCustomPath structs to store the list of RestrictInfo nodes to apply tothe join, as in JoinPaths, if they represent foreign and custom scansreplacing a join with a scan, and by 2) modifying create_scan_plan() increateplan.c to use that list in that case, instead of thebaserestrictinfo list, to get pseudoconstant quals assigned to the join;but#1 would cause an ABI break. So fix by modifying the infrastructureto just disallow replacing joins with such quals.Back-patch to all supported branches.Reported by Nishant Sharma. Patch by me, reviewed by Nishant Sharma andRichard Guo.Discussion:https://postgr.es/m/CADrsxdbcN1vejBaf8a%2BQhrZY5PXL-04mCd4GDu6qm6FigDZd6Q%40mail.gmail.com1 parent38df84c commit6f80a8d
File tree
5 files changed
+78
-2
lines changed- contrib/postgres_fdw
- expected
- sql
- src
- backend/optimizer
- path
- util
- include/optimizer
5 files changed
+78
-2
lines changedLines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2316 | 2316 |
| |
2317 | 2317 |
| |
2318 | 2318 |
| |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
| 2341 | + | |
| 2342 | + | |
| 2343 | + | |
| 2344 | + | |
2319 | 2345 |
| |
2320 | 2346 |
| |
2321 | 2347 |
| |
|
Lines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
640 | 640 |
| |
641 | 641 |
| |
642 | 642 |
| |
| 643 | + | |
| 644 | + | |
| 645 | + | |
643 | 646 |
| |
644 | 647 |
| |
645 | 648 |
| |
|
Lines changed: 17 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
24 | 24 |
| |
25 | 25 |
| |
26 | 26 |
| |
| 27 | + | |
27 | 28 |
| |
28 | 29 |
| |
29 | 30 |
| |
| |||
130 | 131 |
| |
131 | 132 |
| |
132 | 133 |
| |
| 134 | + | |
133 | 135 |
| |
134 | 136 |
| |
135 | 137 |
| |
| |||
321 | 323 |
| |
322 | 324 |
| |
323 | 325 |
| |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
324 | 337 |
| |
325 | 338 |
| |
326 | 339 |
| |
327 | 340 |
| |
328 | 341 |
| |
329 | 342 |
| |
330 |
| - | |
| 343 | + | |
| 344 | + | |
331 | 345 |
| |
332 | 346 |
| |
333 | 347 |
| |
334 | 348 |
| |
335 | 349 |
| |
336 | 350 |
| |
337 | 351 |
| |
338 |
| - | |
| 352 | + | |
| 353 | + | |
339 | 354 |
| |
340 | 355 |
| |
341 | 356 |
| |
|
Lines changed: 30 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
549 | 549 |
| |
550 | 550 |
| |
551 | 551 |
| |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
552 | 582 |
| |
553 | 583 |
| |
554 | 584 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
43 | 43 |
| |
44 | 44 |
| |
45 | 45 |
| |
| 46 | + | |
| 47 | + | |
46 | 48 |
| |
47 | 49 |
| |
48 | 50 |
| |
|
0 commit comments
Comments
(0)