forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite3101a0
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 parentbbcafab commite3101a0
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 changedLines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
541 | 541 |
| |
542 | 542 |
| |
543 | 543 |
| |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
544 | 548 |
| |
545 | 549 |
| |
546 | 550 |
| |
| |||
549 | 553 |
| |
550 | 554 |
| |
551 | 555 |
| |
552 |
| - | |
| 556 | + | |
553 | 557 |
| |
554 | 558 |
| |
555 | 559 |
| |
|
Lines changed: 56 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3420 | 3420 |
| |
3421 | 3421 |
| |
3422 | 3422 |
| |
| 3423 | + | |
| 3424 | + | |
| 3425 | + | |
| 3426 | + | |
| 3427 | + | |
| 3428 | + | |
| 3429 | + | |
| 3430 | + | |
| 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 | + | |
3423 | 3479 |
| |
3424 | 3480 |
| |
3425 | 3481 |
| |
|
Lines changed: 14 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
897 | 897 |
| |
898 | 898 |
| |
899 | 899 |
| |
| 900 | + | |
| 901 | + | |
| 902 | + | |
900 | 903 |
| |
901 | 904 |
| |
902 | 905 |
| |
903 | 906 |
| |
904 | 907 |
| |
905 | 908 |
| |
906 | 909 |
| |
907 |
| - | |
| 910 | + | |
908 | 911 |
| |
909 | 912 |
| |
910 | 913 |
| |
| |||
4374 | 4377 |
| |
4375 | 4378 |
| |
4376 | 4379 |
| |
4377 |
| - | |
| 4380 | + | |
4378 | 4381 |
| |
4379 | 4382 |
| |
4380 | 4383 |
| |
| |||
4511 | 4514 |
| |
4512 | 4515 |
| |
4513 | 4516 |
| |
| 4517 | + | |
| 4518 | + | |
| 4519 | + | |
| 4520 | + | |
| 4521 | + | |
| 4522 | + | |
| 4523 | + | |
4514 | 4524 |
| |
4515 | 4525 |
| |
4516 | 4526 |
| |
| |||
4602 | 4612 |
| |
4603 | 4613 |
| |
4604 | 4614 |
| |
4605 |
| - | |
| 4615 | + | |
4606 | 4616 |
| |
4607 | 4617 |
| |
4608 | 4618 |
| |
| |||
4921 | 4931 |
| |
4922 | 4932 |
| |
4923 | 4933 |
| |
4924 |
| - | |
| 4934 | + | |
4925 | 4935 |
| |
4926 | 4936 |
| |
4927 | 4937 |
| |
|
Lines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
878 | 878 |
| |
879 | 879 |
| |
880 | 880 |
| |
| 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 | + | |
881 | 907 |
| |
882 | 908 |
| |
883 | 909 |
| |
|
Lines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1967 | 1967 |
| |
1968 | 1968 |
| |
1969 | 1969 |
| |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
| 1987 | + | |
| 1988 | + | |
| 1989 | + | |
| 1990 | + | |
1970 | 1991 |
| |
1971 | 1992 |
| |
1972 | 1993 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1041 | 1041 |
| |
1042 | 1042 |
| |
1043 | 1043 |
| |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
1044 | 1047 |
| |
1045 | 1048 |
| |
1046 | 1049 |
| |
| |||
1140 | 1143 |
| |
1141 | 1144 |
| |
1142 | 1145 |
| |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
1143 | 1149 |
| |
1144 | 1150 |
| |
1145 | 1151 |
| |
| |||
1336 | 1342 |
| |
1337 | 1343 |
| |
1338 | 1344 |
| |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
1339 | 1348 |
| |
1340 | 1349 |
| |
1341 | 1350 |
| |
|
0 commit comments
Comments
(0)