forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit6ee41a3
committed
Fix mis-planning of repeated application of a projection.
create_projection_plan contains a hidden assumption (here madeexplicit by an Assert) that a projection-capable Path will yield aprojection-capable Plan. Unfortunately, that assumption is violatedonly a few lines away, by create_projection_plan itself. This meansthat two stacked ProjectionPaths can yield an outcome where we try tojam the upper path's tlist into a non-projection-capable child node,resulting in an invalid plan.There isn't any good reason to have stacked ProjectionPaths; indeed thewhole concept is faulty, since the set of Vars/Aggs/etc needed by theupper one wouldn't necessarily be available in the output of the lowerone, nor could the lower one create such values if they weren'tavailable from its input. Hence, we can fix this by adjustingcreate_projection_path to strip any top-level ProjectionPath from thesubpath it's given. (This amounts to saying "oh, we changed ourminds about what we need to project here".)The test case added here only fails in v13 and HEAD; before that, wedon't attempt to shove the Sort into the parallel part of the plan,for reasons that aren't entirely clear to me. However, all thedirectly-related code looks generally the same as far back as v11,where the hazard was introduced (byd7c19e6). So I've got no faiththat the same type of bug doesn't exist in v11 and v12, given theright test case. Hence, back-patch the code changes, but not theirrelevant test case, into those branches.Per report from Bas Poot.Discussion:https://postgr.es/m/534fca83789c4a378c7de379e9067d4f@politie.nl1 parentd03eeab commit6ee41a3
File tree
4 files changed
+46
-1
lines changed- src
- backend/optimizer
- plan
- util
- test/regress
- expected
- sql
4 files changed
+46
-1
lines changedLines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1976 | 1976 |
| |
1977 | 1977 |
| |
1978 | 1978 |
| |
| 1979 | + | |
1979 | 1980 |
| |
1980 | 1981 |
| |
1981 | 1982 |
| |
|
Lines changed: 18 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2632 | 2632 |
| |
2633 | 2633 |
| |
2634 | 2634 |
| |
2635 |
| - | |
| 2635 | + | |
| 2636 | + | |
| 2637 | + | |
| 2638 | + | |
| 2639 | + | |
| 2640 | + | |
| 2641 | + | |
| 2642 | + | |
| 2643 | + | |
| 2644 | + | |
| 2645 | + | |
| 2646 | + | |
| 2647 | + | |
| 2648 | + | |
| 2649 | + | |
| 2650 | + | |
| 2651 | + | |
2636 | 2652 |
| |
2637 | 2653 |
| |
2638 | 2654 |
| |
| |||
2658 | 2674 |
| |
2659 | 2675 |
| |
2660 | 2676 |
| |
| 2677 | + | |
2661 | 2678 |
| |
2662 | 2679 |
| |
2663 | 2680 |
| |
|
Lines changed: 23 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1126 | 1126 |
| |
1127 | 1127 |
| |
1128 | 1128 |
| |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
1129 | 1152 |
| |
1130 | 1153 |
| |
1131 | 1154 |
| |
|
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
429 | 429 |
| |
430 | 430 |
| |
431 | 431 |
| |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
432 | 436 |
| |
433 | 437 |
| |
434 | 438 |
| |
|
0 commit comments
Comments
(0)