forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4da6439
committed
Fix mark_placeholder_maybe_needed to handle LATERAL references.
If a PlaceHolderVar contains a pulled-up LATERAL reference, its minimumpossible evaluation level might be higher in the join tree than itsoriginal syntactic location. That in turn affects the ph_needed level forany contained PlaceHolderVars (that is, those PHVs had better propagate upthe join tree at least to the evaluation level of the outer PHV). We gotthis mostly right, but mark_placeholder_maybe_needed() failed to accountfor the effect, and in consequence could leave the inner PHVs withph_may_need less than what their ultimate ph_needed value will be. That'sbad because it could lead to failure to select a join order that will allowevaluation of the inner PHV at a valid location. Fix that, and add anAssert that checks that we don't ever set ph_needed to more thanph_may_need.1 parent53fa0c6 commit4da6439
File tree
4 files changed
+67
-4
lines changed- src
- backend/optimizer
- plan
- util
- test/regress
- expected
- sql
4 files changed
+67
-4
lines changedLines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
199 | 199 |
| |
200 | 200 |
| |
201 | 201 |
| |
202 |
| - | |
| 202 | + | |
| 203 | + | |
203 | 204 |
| |
204 | 205 |
| |
205 | 206 |
| |
| 207 | + | |
| 208 | + | |
206 | 209 |
| |
207 | 210 |
| |
208 | 211 |
| |
|
Lines changed: 12 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
250 | 250 |
| |
251 | 251 |
| |
252 | 252 |
| |
| 253 | + | |
| 254 | + | |
253 | 255 |
| |
254 | 256 |
| |
255 | 257 |
| |
| |||
258 | 260 |
| |
259 | 261 |
| |
260 | 262 |
| |
261 |
| - | |
262 |
| - | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
263 | 267 |
| |
| 268 | + | |
| 269 | + | |
| 270 | + | |
264 | 271 |
| |
265 |
| - | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
266 | 275 |
| |
267 | 276 |
| |
268 | 277 |
| |
|
Lines changed: 40 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3465 | 3465 |
| |
3466 | 3466 |
| |
3467 | 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 | + | |
| 3494 | + | |
| 3495 | + | |
| 3496 | + | |
| 3497 | + | |
| 3498 | + | |
| 3499 | + | |
| 3500 | + | |
| 3501 | + | |
| 3502 | + | |
| 3503 | + | |
| 3504 | + | |
| 3505 | + | |
| 3506 | + | |
| 3507 | + | |
3468 | 3508 |
| |
3469 | 3509 |
| |
3470 | 3510 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
942 | 942 |
| |
943 | 943 |
| |
944 | 944 |
| |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
945 | 956 |
| |
946 | 957 |
| |
947 | 958 |
| |
|
0 commit comments
Comments
(0)