forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit92e7a53
committed
Remove inadequate assertion check in CTE inlining.
inline_cte() expected to find exactly as many references to thetarget CTE as its cterefcount indicates. While that should beaccurate for the tree as emitted by the parser, there are someoptimizations that occur upstream of here that could falsify it,notably removal of unused subquery output expressions.Trying to make the accounting 100% accurate seems expensive anddoomed to future breakage. It's not really worth it, becauseall this code is protecting is downstream assumptions that everyreferenced CTE has a plan. Let's convert those assertions toregular test-and-elog just in case there's some actual problem,and then drop the failing assertion.Per report from Tomas Vondra (thanks also to Richard Guo foranalysis). Back-patch to v12 where the faulty code came in.Discussion:https://postgr.es/m/29196a1e-ed47-c7ca-9be2-b1c636816183@enterprisedb.com1 parent914611e commit92e7a53
File tree
6 files changed
+101
-11
lines changed- src
- backend/optimizer
- path
- plan
- include/nodes
- test/regress
- expected
- sql
6 files changed
+101
-11
lines changedLines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2804 | 2804 |
| |
2805 | 2805 |
| |
2806 | 2806 |
| |
2807 |
| - | |
| 2807 | + | |
| 2808 | + | |
2808 | 2809 |
| |
2809 | 2810 |
| |
2810 | 2811 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3898 | 3898 |
| |
3899 | 3899 |
| |
3900 | 3900 |
| |
3901 |
| - | |
| 3901 | + | |
| 3902 | + | |
3902 | 3903 |
| |
3903 | 3904 |
| |
3904 | 3905 |
| |
|
Lines changed: 0 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
61 | 61 |
| |
62 | 62 |
| |
63 | 63 |
| |
64 |
| - | |
65 | 64 |
| |
66 | 65 |
| |
67 | 66 |
| |
| |||
1157 | 1156 |
| |
1158 | 1157 |
| |
1159 | 1158 |
| |
1160 |
| - | |
1161 | 1159 |
| |
1162 | 1160 |
| |
1163 | 1161 |
| |
1164 |
| - | |
1165 |
| - | |
1166 |
| - | |
1167 | 1162 |
| |
1168 | 1163 |
| |
1169 | 1164 |
| |
| |||
1226 | 1221 |
| |
1227 | 1222 |
| |
1228 | 1223 |
| |
1229 |
| - | |
1230 |
| - | |
1231 |
| - | |
1232 | 1224 |
| |
1233 | 1225 |
| |
1234 | 1226 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
241 | 241 |
| |
242 | 242 |
| |
243 | 243 |
| |
244 |
| - | |
| 244 | + | |
| 245 | + | |
245 | 246 |
| |
246 | 247 |
| |
247 | 248 |
| |
|
Lines changed: 64 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2535 | 2535 |
| |
2536 | 2536 |
| |
2537 | 2537 |
| |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
| 2546 | + | |
| 2547 | + | |
| 2548 | + | |
| 2549 | + | |
| 2550 | + | |
| 2551 | + | |
| 2552 | + | |
| 2553 | + | |
| 2554 | + | |
| 2555 | + | |
| 2556 | + | |
| 2557 | + | |
| 2558 | + | |
| 2559 | + | |
| 2560 | + | |
| 2561 | + | |
| 2562 | + | |
| 2563 | + | |
| 2564 | + | |
| 2565 | + | |
| 2566 | + | |
| 2567 | + | |
| 2568 | + | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
| 2595 | + | |
| 2596 | + | |
| 2597 | + | |
| 2598 | + | |
| 2599 | + | |
| 2600 | + | |
| 2601 | + | |
2538 | 2602 |
| |
2539 | 2603 |
| |
2540 | 2604 |
| |
|
Lines changed: 31 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1181 | 1181 |
| |
1182 | 1182 |
| |
1183 | 1183 |
| |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
1184 | 1215 |
| |
1185 | 1216 |
| |
1186 | 1217 |
| |
|
0 commit comments
Comments
(0)