- Notifications
You must be signed in to change notification settings - Fork28
Commit9d6d2b2
committed
Ensure that foreign scans with lateral refs are planned correctly.
As reported in bug #15613 from Srinivasan S A, file_fdw and postgres_fdwneglected to mark plain baserel foreign paths as parameterized when therelation has lateral_relids. Other FDWs have surely copied this mistake,so rather than just patching those two modules, install a band-aid fixin create_foreignscan_path to rectify the mistake centrally.Although the band-aid is enough to fix the visible symptom, correctthe calls in file_fdw and postgres_fdw anyway, so that they are validexamples for external FDWs.Also, since the band-aid isn't enough to make this work for parameterizedforeign joins, throw an elog(ERROR) if such a case is passed tocreate_foreignscan_path. This shouldn't pose much of a problem forexisting external FDWs, since it's likely they aren't trying to make suchpaths anyway (though some of them may need a defense against joins withlateral_relids, similar to the one this patch installs into postgres_fdw).Add some assertions in relnode.c to catch future occurrences of the sameerror --- in particular, as backstop against core-code mistakes like theone fixed by commitbdd9a99.Discussion:https://postgr.es/m/15613-092be1be9576c728@postgresql.org1 parent8722d2c commit9d6d2b2
File tree
6 files changed
+131
-5
lines changed- contrib
- file_fdw
- postgres_fdw
- expected
- sql
- src/backend/optimizer/util
6 files changed
+131
-5
lines changed| 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 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3435 | 3435 | | |
3436 | 3436 | | |
3437 | 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 | + | |
| 3488 | + | |
| 3489 | + | |
| 3490 | + | |
| 3491 | + | |
| 3492 | + | |
| 3493 | + | |
3438 | 3494 | | |
3439 | 3495 | | |
3440 | 3496 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
930 | 930 | | |
931 | 931 | | |
932 | 932 | | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
933 | 936 | | |
934 | 937 | | |
935 | 938 | | |
936 | 939 | | |
937 | 940 | | |
938 | 941 | | |
939 | 942 | | |
940 | | - | |
| 943 | + | |
941 | 944 | | |
942 | 945 | | |
943 | 946 | | |
| |||
4978 | 4981 | | |
4979 | 4982 | | |
4980 | 4983 | | |
4981 | | - | |
| 4984 | + | |
4982 | 4985 | | |
4983 | 4986 | | |
4984 | 4987 | | |
| |||
5115 | 5118 | | |
5116 | 5119 | | |
5117 | 5120 | | |
| 5121 | + | |
| 5122 | + | |
| 5123 | + | |
| 5124 | + | |
| 5125 | + | |
| 5126 | + | |
| 5127 | + | |
5118 | 5128 | | |
5119 | 5129 | | |
5120 | 5130 | | |
| |||
5206 | 5216 | | |
5207 | 5217 | | |
5208 | 5218 | | |
5209 | | - | |
| 5219 | + | |
5210 | 5220 | | |
5211 | 5221 | | |
5212 | 5222 | | |
| |||
5534 | 5544 | | |
5535 | 5545 | | |
5536 | 5546 | | |
5537 | | - | |
| 5547 | + | |
5538 | 5548 | | |
5539 | 5549 | | |
5540 | 5550 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
884 | 884 | | |
885 | 885 | | |
886 | 886 | | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
887 | 913 | | |
888 | 914 | | |
889 | 915 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2069 | 2069 | | |
2070 | 2070 | | |
2071 | 2071 | | |
| 2072 | + | |
| 2073 | + | |
| 2074 | + | |
| 2075 | + | |
| 2076 | + | |
| 2077 | + | |
| 2078 | + | |
| 2079 | + | |
| 2080 | + | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
| 2084 | + | |
| 2085 | + | |
| 2086 | + | |
| 2087 | + | |
| 2088 | + | |
| 2089 | + | |
| 2090 | + | |
| 2091 | + | |
| 2092 | + | |
2072 | 2093 | | |
2073 | 2094 | | |
2074 | 2095 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1247 | 1247 | | |
1248 | 1248 | | |
1249 | 1249 | | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
1250 | 1253 | | |
1251 | 1254 | | |
1252 | 1255 | | |
| |||
1342 | 1345 | | |
1343 | 1346 | | |
1344 | 1347 | | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
1345 | 1351 | | |
1346 | 1352 | | |
1347 | 1353 | | |
| |||
1533 | 1539 | | |
1534 | 1540 | | |
1535 | 1541 | | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
1536 | 1545 | | |
1537 | 1546 | | |
1538 | 1547 | | |
| |||
0 commit comments
Comments
(0)