- Notifications
You must be signed in to change notification settings - Fork5
Commit131c7e7
committed
postgres_fdw: Check PlaceHolderVars before pushing down a join.
As discovered by Andreas Seltenreich via sqlsmith, it's possible for aremote join to need to generate a target list which contains aPlaceHolderVar which would need to be evaluated on the remote server.This happens when we try to push down a join tree which contains outerjoins and the nullable side of the join contains a subquery whichevauates some expression which can go to NULL above the level of thejoin. Since the deparsing logic can't build a remote query thatinvolves subqueries, it fails while trying to produce an SQL querythat can be sent to the remote side. Detect such cases and don't tryto push down the join at all.It's actually fine to push down the join if the PlaceHolderVar needsto be evaluated at the current join level. This patch makes a smallchange to build_tlist_to_deparse so that this case will work.Amit Langote, Ashutosh Bapat, and me.1 parent5484c0a commit131c7e7
File tree
4 files changed
+96
-12
lines changed- contrib/postgres_fdw
- expected
- sql
4 files changed
+96
-12
lines changedLines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
731 | 731 |
| |
732 | 732 |
| |
733 | 733 |
| |
734 |
| - | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
735 | 737 |
| |
736 | 738 |
| |
737 | 739 |
| |
|
Lines changed: 58 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2202 | 2202 |
| |
2203 | 2203 |
| |
2204 | 2204 |
| |
| 2205 | + | |
| 2206 | + | |
| 2207 | + | |
| 2208 | + | |
| 2209 | + | |
| 2210 | + | |
| 2211 | + | |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
| 2229 | + | |
| 2230 | + | |
| 2231 | + | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
| 2253 | + | |
| 2254 | + | |
| 2255 | + | |
| 2256 | + | |
| 2257 | + | |
| 2258 | + | |
| 2259 | + | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
2205 | 2263 |
| |
2206 | 2264 |
| |
2207 | 2265 |
| |
|
Lines changed: 23 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3952 | 3952 |
| |
3953 | 3953 |
| |
3954 | 3954 |
| |
3955 |
| - | |
3956 |
| - | |
3957 |
| - | |
3958 |
| - | |
3959 |
| - | |
3960 |
| - | |
3961 |
| - | |
3962 |
| - | |
3963 | 3955 |
| |
3964 | 3956 |
| |
3965 | 3957 |
| |
| |||
4036 | 4028 |
| |
4037 | 4029 |
| |
4038 | 4030 |
| |
| 4031 | + | |
| 4032 | + | |
| 4033 | + | |
| 4034 | + | |
| 4035 | + | |
| 4036 | + | |
| 4037 | + | |
| 4038 | + | |
| 4039 | + | |
| 4040 | + | |
| 4041 | + | |
| 4042 | + | |
| 4043 | + | |
| 4044 | + | |
| 4045 | + | |
| 4046 | + | |
| 4047 | + | |
| 4048 | + | |
| 4049 | + | |
| 4050 | + | |
4039 | 4051 |
| |
4040 | 4052 |
| |
4041 | 4053 |
| |
| |||
4116 | 4128 |
| |
4117 | 4129 |
| |
4118 | 4130 |
| |
4119 |
| - | |
4120 |
| - | |
4121 |
| - | |
| 4131 | + | |
| 4132 | + | |
| 4133 | + | |
4122 | 4134 |
| |
4123 | 4135 |
| |
4124 | 4136 |
| |
|
Lines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
527 | 527 |
| |
528 | 528 |
| |
529 | 529 |
| |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
530 | 542 |
| |
531 | 543 |
| |
532 | 544 |
| |
|
0 commit comments
Comments
(0)