- Notifications
You must be signed in to change notification settings - Fork5
Commit83204e1
committed
Fix contrib/postgres_fdw to handle multiple join conditions properly.
The previous coding supposed that it could consider just a single joincondition in any one parameterized path for the foreign table. But inreality, the parameterized-path machinery forces all join clauses that are"movable to" the foreign table to be evaluated at that node; includingclauses that we might not consider safe to send across. Such cases wouldresult in an Assert failure in an assert-enabled build, and otherwise insending an unsafe clause to the foreign server, which might result inerrors or silently-wrong answers. A lesser problem was that thecost/rowcount estimates generated for the parameterized path failed toaccount for any additional join quals that get assigned to the scan.To fix, rewrite postgresGetForeignPaths so that it correctly collects allthe movable quals for any one outer relation when generating parameterizedpaths; we'll now generate just one path per outer relation not one per joinqual. Also fix bogus assumptions in postgresGetForeignPlan andestimate_path_cost_size that only safe-to-send join quals will bepresented.Based on complaint from Etsuro Fujita that the path costs were beingmiscalculated, though this is significantly different from his proposedpatch.1 parent4ea2e2d commit83204e1
File tree
5 files changed
+252
-71
lines changed- contrib/postgres_fdw
- expected
- sql
5 files changed
+252
-71
lines changedLines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
134 | 134 |
| |
135 | 135 |
| |
136 | 136 |
| |
137 |
| - | |
138 |
| - | |
| 137 | + | |
| 138 | + | |
139 | 139 |
| |
140 | 140 |
| |
141 | 141 |
| |
142 | 142 |
| |
143 | 143 |
| |
144 | 144 |
| |
| 145 | + | |
145 | 146 |
| |
146 | 147 |
| |
147 | 148 |
| |
| |||
150 | 151 |
| |
151 | 152 |
| |
152 | 153 |
| |
153 |
| - | |
| 154 | + | |
154 | 155 |
| |
155 | 156 |
| |
156 | 157 |
| |
|
0 commit comments
Comments
(0)