forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit34ea1ab
committed
Split create_foreignscan_path() into three functions.
Up to now postgres_fdw has been using create_foreignscan_path() togenerate not only base-relation paths, but also paths for foreign joinsand foreign upperrels. This is wrong, because create_foreignscan_path()calls get_baserel_parampathinfo() which will only do the right thing forbaserels. It accidentally fails to fail for unparameterized paths, whichare the only ones postgres_fdw (thought it) was handling, but we reallyneed different APIs for the baserel and join cases.In HEAD, the best thing to do seems to be to split up the baserel,joinrel, and upperrel cases into three functions so that they canhave different APIs. I haven't actually given create_foreign_join_patha different API in this commit: we should spend a bit of time thinkingabout just what we want to do there, since perhaps FDWs would want todo something different from the build-up-a-join-pairwise approach thatget_joinrel_parampathinfo expects. In the meantime, since postgres_fdwisn't prepared to generate parameterized joins anyway, just give it adefense against trying to plan joins with lateral refs.In addition (and this is what triggered this whole mess) fix bug #15613from Srinivasan S A, by teaching file_fdw and postgres_fdw that plainbaserel foreign paths still have outer refs if the relation haslateral_relids. Add some assertions in relnode.c to catch futureoccurrences of the same error --- in particular, to catch other FDWsdoing that, but also as backstop against core-code mistakes like theone fixed by commitbdd9a99.Bug #15613 also needs to be fixed in the back branches, but theappropriate fix will look quite a bit different there, since we don'twant to assume that existing FDWs get the word right away.Discussion:https://postgr.es/m/15613-092be1be9576c728@postgresql.org1 parent51b0259 commit34ea1ab
File tree
8 files changed
+275
-44
lines changed- contrib
- file_fdw
- postgres_fdw
- expected
- sql
- doc/src/sgml
- src
- backend/optimizer/util
- include/optimizer
8 files changed
+275
-44
lines changedLines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
556 | 556 |
| |
557 | 557 |
| |
558 | 558 |
| |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
559 | 563 |
| |
560 | 564 |
| |
561 | 565 |
| |
| |||
564 | 568 |
| |
565 | 569 |
| |
566 | 570 |
| |
567 |
| - | |
| 571 | + | |
568 | 572 |
| |
569 | 573 |
| |
570 | 574 |
| |
|
Lines changed: 56 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3429 | 3429 |
| |
3430 | 3430 |
| |
3431 | 3431 |
| |
| 3432 | + | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
| 3436 | + | |
| 3437 | + | |
| 3438 | + | |
| 3439 | + | |
| 3440 | + | |
| 3441 | + | |
| 3442 | + | |
| 3443 | + | |
| 3444 | + | |
| 3445 | + | |
| 3446 | + | |
| 3447 | + | |
| 3448 | + | |
| 3449 | + | |
| 3450 | + | |
| 3451 | + | |
| 3452 | + | |
| 3453 | + | |
| 3454 | + | |
| 3455 | + | |
| 3456 | + | |
| 3457 | + | |
| 3458 | + | |
| 3459 | + | |
| 3460 | + | |
| 3461 | + | |
| 3462 | + | |
| 3463 | + | |
| 3464 | + | |
| 3465 | + | |
| 3466 | + | |
| 3467 | + | |
| 3468 | + | |
| 3469 | + | |
| 3470 | + | |
| 3471 | + | |
| 3472 | + | |
| 3473 | + | |
| 3474 | + | |
| 3475 | + | |
| 3476 | + | |
| 3477 | + | |
| 3478 | + | |
| 3479 | + | |
| 3480 | + | |
| 3481 | + | |
| 3482 | + | |
| 3483 | + | |
| 3484 | + | |
| 3485 | + | |
| 3486 | + | |
| 3487 | + | |
3432 | 3488 |
| |
3433 | 3489 |
| |
3434 | 3490 |
| |
|
Lines changed: 56 additions & 34 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
937 | 937 |
| |
938 | 938 |
| |
939 | 939 |
| |
| 940 | + | |
| 941 | + | |
| 942 | + | |
940 | 943 |
| |
941 | 944 |
| |
942 | 945 |
| |
943 | 946 |
| |
944 | 947 |
| |
945 | 948 |
| |
946 | 949 |
| |
947 |
| - | |
| 950 | + | |
948 | 951 |
| |
949 | 952 |
| |
950 | 953 |
| |
| |||
3295 | 3298 |
| |
3296 | 3299 |
| |
3297 | 3300 |
| |
3298 |
| - | |
| 3301 | + | |
3299 | 3302 |
| |
3300 | 3303 |
| |
3301 | 3304 |
| |
| |||
3936 | 3939 |
| |
3937 | 3940 |
| |
3938 | 3941 |
| |
3939 |
| - | |
3940 |
| - | |
| 3942 | + | |
| 3943 | + | |
| 3944 | + | |
3941 | 3945 |
| |
3942 | 3946 |
| |
3943 | 3947 |
| |
| |||
4943 | 4947 |
| |
4944 | 4948 |
| |
4945 | 4949 |
| |
4946 |
| - | |
4947 |
| - | |
4948 |
| - | |
4949 |
| - | |
4950 |
| - | |
4951 |
| - | |
4952 |
| - | |
4953 |
| - | |
4954 |
| - | |
4955 |
| - | |
| 4950 | + | |
| 4951 | + | |
| 4952 | + | |
| 4953 | + | |
| 4954 | + | |
| 4955 | + | |
| 4956 | + | |
| 4957 | + | |
| 4958 | + | |
| 4959 | + | |
| 4960 | + | |
| 4961 | + | |
| 4962 | + | |
| 4963 | + | |
| 4964 | + | |
| 4965 | + | |
| 4966 | + | |
| 4967 | + | |
| 4968 | + | |
| 4969 | + | |
| 4970 | + | |
| 4971 | + | |
4956 | 4972 |
| |
4957 | 4973 |
| |
4958 | 4974 |
| |
| |||
5087 | 5103 |
| |
5088 | 5104 |
| |
5089 | 5105 |
| |
| 5106 | + | |
| 5107 | + | |
| 5108 | + | |
| 5109 | + | |
| 5110 | + | |
| 5111 | + | |
| 5112 | + | |
5090 | 5113 |
| |
5091 | 5114 |
| |
5092 | 5115 |
| |
| |||
5171 | 5194 |
| |
5172 | 5195 |
| |
5173 | 5196 |
| |
5174 |
| - | |
5175 |
| - | |
5176 |
| - | |
5177 |
| - | |
5178 |
| - | |
5179 |
| - | |
5180 |
| - | |
5181 |
| - | |
5182 |
| - | |
5183 |
| - | |
| 5197 | + | |
| 5198 | + | |
| 5199 | + | |
| 5200 | + | |
| 5201 | + | |
| 5202 | + | |
| 5203 | + | |
| 5204 | + | |
| 5205 | + | |
| 5206 | + | |
5184 | 5207 |
| |
5185 | 5208 |
| |
5186 | 5209 |
| |
| |||
5515 | 5538 |
| |
5516 | 5539 |
| |
5517 | 5540 |
| |
5518 |
| - | |
5519 |
| - | |
5520 |
| - | |
5521 |
| - | |
5522 |
| - | |
5523 |
| - | |
5524 |
| - | |
5525 |
| - | |
5526 |
| - | |
5527 |
| - | |
| 5541 | + | |
| 5542 | + | |
| 5543 | + | |
| 5544 | + | |
| 5545 | + | |
| 5546 | + | |
| 5547 | + | |
| 5548 | + | |
| 5549 | + | |
5528 | 5550 |
| |
5529 | 5551 |
| |
5530 | 5552 |
| |
|
Lines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
879 | 879 |
| |
880 | 880 |
| |
881 | 881 |
| |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
882 | 908 |
| |
883 | 909 |
| |
884 | 910 |
| |
|
Lines changed: 6 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
309 | 309 |
| |
310 | 310 |
| |
311 | 311 |
| |
312 |
| - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
313 | 315 |
| |
314 | 316 |
| |
315 | 317 |
| |
| |||
369 | 371 |
| |
370 | 372 |
| |
371 | 373 |
| |
372 |
| - | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
373 | 377 |
| |
374 | 378 |
| |
375 | 379 |
| |
|
0 commit comments
Comments
(0)