forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit85e5e22
committed
Fix a PlaceHolderVar-related oversight in star-schema planning patch.
In commitb514a74, I changed the plannerso that it would allow nestloop paths to remain partially parameterized,ie the inner relation might need parameters from both the current outerrelation and some upper-level outer relation. That's fine so long as we'retalking about distinct parameters; but the patch also allowed creation ofnestloop paths for cases where the inner relation's parameter was aPlaceHolderVar whose eval_at set included the current outer relation andsome upper-level one. That does *not* work.In principle we could allow such a PlaceHolderVar to be evaluated at thelower join node using values passed down from the upper relation along withvalues from the join's own outer relation. However, nodeNestloop.c onlysupports simple Vars not arbitrary expressions as nestloop parameters.createplan.c is also a few bricks shy of being able to handle such cases;it misplaces the PlaceHolderVar parameters in the plan tree, which is whythe visible symptoms of this bug are "plan should not reference subplan'svariable" and "failed to assign all NestLoopParams to plan nodes" plannererrors.Adding the necessary complexity to make this work doesn't seem like itwould be repaid in significantly better plans, because in cases where sucha PHV exists, there is probably a corresponding join order constraint thatwould allow a good plan to be found without using the star-schema exception.Furthermore, adding complexity to nodeNestloop.c would create a run-timepenalty even for plans where this whole consideration is irrelevant.So let's just reject such paths instead.Per fuzz testing by Andreas Seltenreich; the added regression test is basedon his example query. Back-patch to 9.2, like the previous patch.1 parent369342c commit85e5e22
File tree
3 files changed
+158
-26
lines changed- src
- backend/optimizer/path
- test/regress
- expected
- sql
3 files changed
+158
-26
lines changedLines changed: 76 additions & 26 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
118 | 118 |
| |
119 | 119 |
| |
120 | 120 |
| |
121 |
| - | |
| 121 | + | |
122 | 122 |
| |
123 | 123 |
| |
124 | 124 |
| |
| |||
270 | 270 |
| |
271 | 271 |
| |
272 | 272 |
| |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
273 | 341 |
| |
274 | 342 |
| |
275 | 343 |
| |
| |||
289 | 357 |
| |
290 | 358 |
| |
291 | 359 |
| |
292 |
| - | |
| 360 | + | |
| 361 | + | |
293 | 362 |
| |
294 | 363 |
| |
295 | 364 |
| |
296 | 365 |
| |
297 |
| - | |
| 366 | + | |
| 367 | + | |
298 | 368 |
| |
299 |
| - | |
300 |
| - | |
301 |
| - | |
302 |
| - | |
303 |
| - | |
304 |
| - | |
305 |
| - | |
306 |
| - | |
307 |
| - | |
308 |
| - | |
309 |
| - | |
310 |
| - | |
311 |
| - | |
312 |
| - | |
313 |
| - | |
314 |
| - | |
315 |
| - | |
316 |
| - | |
317 |
| - | |
318 |
| - | |
319 |
| - | |
320 |
| - | |
321 |
| - | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
322 | 372 |
| |
323 | 373 |
| |
324 | 374 |
| |
|
Lines changed: 51 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2949 | 2949 |
| |
2950 | 2950 |
| |
2951 | 2951 |
| |
| 2952 | + | |
| 2953 | + | |
| 2954 | + | |
| 2955 | + | |
| 2956 | + | |
| 2957 | + | |
| 2958 | + | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
| 2966 | + | |
| 2967 | + | |
| 2968 | + | |
| 2969 | + | |
| 2970 | + | |
| 2971 | + | |
| 2972 | + | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
| 2986 | + | |
| 2987 | + | |
| 2988 | + | |
| 2989 | + | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
2952 | 3003 |
| |
2953 | 3004 |
| |
2954 | 3005 |
| |
|
Lines changed: 31 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
843 | 843 |
| |
844 | 844 |
| |
845 | 845 |
| |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
846 | 877 |
| |
847 | 878 |
| |
848 | 879 |
| |
|
0 commit comments
Comments
(0)