forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitd5d2205
committed
Fix assert failure when planning setop subqueries with CTEs
66c0185 adjusted the UNION planner to request that union child queriesproduce Paths correctly ordered to implement the UNION by way ofMergeAppend followed by Unique. The code there made a bad assumptionthat if the root->parent_root->parse had setOperations set that thequery must be the child subquery of a set operation. That's not truewhen it comes to planning a non-inlined CTE which is parented by a setoperation. This causes issues as the CTE's targetlist has norequirement to match up to the SetOperationStmt's groupClausesFix this by adding a new parameter to both subquery_planner() andgrouping_planner() to explicitly pass the SetOperationStmt only whenplanning set operation child subqueries.Thank you to Tom Lane for helping to rationalize the decision on thebest function signature for subquery_planner().Reported-by: Alexander LakhinDiscussion:https://postgr.es/m/242fc7c6-a8aa-2daf-ac4c-0a231e2619c1@gmail.com1 parent3622c80 commitd5d2205
File tree
7 files changed
+66
-35
lines changed- src
- backend/optimizer
- path
- plan
- prep
- include/optimizer
- test/regress
- expected
- sql
7 files changed
+66
-35
lines changedLines changed: 2 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2645 | 2645 |
| |
2646 | 2646 |
| |
2647 | 2647 |
| |
2648 |
| - | |
2649 |
| - | |
2650 |
| - | |
| 2648 | + | |
| 2649 | + | |
2651 | 2650 |
| |
2652 | 2651 |
| |
2653 | 2652 |
| |
|
Lines changed: 21 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
127 | 127 |
| |
128 | 128 |
| |
129 | 129 |
| |
130 |
| - | |
| 130 | + | |
| 131 | + | |
131 | 132 |
| |
132 | 133 |
| |
133 | 134 |
| |
| |||
411 | 412 |
| |
412 | 413 |
| |
413 | 414 |
| |
414 |
| - | |
415 |
| - | |
| 415 | + | |
416 | 416 |
| |
417 | 417 |
| |
418 | 418 |
| |
| |||
603 | 603 |
| |
604 | 604 |
| |
605 | 605 |
| |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
606 | 610 |
| |
607 | 611 |
| |
608 | 612 |
| |
| |||
621 | 625 |
| |
622 | 626 |
| |
623 | 627 |
| |
624 |
| - | |
625 |
| - | |
626 |
| - | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
627 | 631 |
| |
628 | 632 |
| |
629 | 633 |
| |
| |||
1085 | 1089 |
| |
1086 | 1090 |
| |
1087 | 1091 |
| |
1088 |
| - | |
| 1092 | + | |
1089 | 1093 |
| |
1090 | 1094 |
| |
1091 | 1095 |
| |
| |||
1283 | 1287 |
| |
1284 | 1288 |
| |
1285 | 1289 |
| |
1286 |
| - | |
| 1290 | + | |
| 1291 | + | |
| 1292 | + | |
| 1293 | + | |
| 1294 | + | |
1287 | 1295 |
| |
1288 | 1296 |
| |
1289 | 1297 |
| |
| |||
1294 | 1302 |
| |
1295 | 1303 |
| |
1296 | 1304 |
| |
1297 |
| - | |
| 1305 | + | |
| 1306 | + | |
1298 | 1307 |
| |
1299 | 1308 |
| |
1300 | 1309 |
| |
| |||
1510 | 1519 |
| |
1511 | 1520 |
| |
1512 | 1521 |
| |
1513 |
| - | |
1514 |
| - | |
| 1522 | + | |
| 1523 | + | |
1515 | 1524 |
| |
1516 |
| - | |
1517 |
| - | |
1518 |
| - | |
1519 |
| - | |
1520 |
| - | |
1521 |
| - | |
1522 |
| - | |
| 1525 | + | |
1523 | 1526 |
| |
1524 | 1527 |
| |
1525 | 1528 |
| |
|
Lines changed: 6 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
218 | 218 |
| |
219 | 219 |
| |
220 | 220 |
| |
221 |
| - | |
222 |
| - | |
223 |
| - | |
| 221 | + | |
| 222 | + | |
224 | 223 |
| |
225 | 224 |
| |
226 | 225 |
| |
| |||
266 | 265 |
| |
267 | 266 |
| |
268 | 267 |
| |
269 |
| - | |
270 |
| - | |
271 |
| - | |
| 268 | + | |
| 269 | + | |
272 | 270 |
| |
273 | 271 |
| |
274 | 272 |
| |
| |||
967 | 965 |
| |
968 | 966 |
| |
969 | 967 |
| |
970 |
| - | |
971 |
| - | |
972 |
| - | |
| 968 | + | |
| 969 | + | |
973 | 970 |
| |
974 | 971 |
| |
975 | 972 |
| |
|
Lines changed: 10 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
244 | 244 |
| |
245 | 245 |
| |
246 | 246 |
| |
| 247 | + | |
247 | 248 |
| |
248 | 249 |
| |
249 | 250 |
| |
| |||
257 | 258 |
| |
258 | 259 |
| |
259 | 260 |
| |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
260 | 267 |
| |
261 |
| - | |
262 |
| - | |
263 |
| - | |
264 |
| - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
265 | 271 |
| |
266 | 272 |
| |
267 | 273 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
44 | 44 |
| |
45 | 45 |
| |
46 | 46 |
| |
47 |
| - | |
| 47 | + | |
| 48 | + | |
48 | 49 |
| |
49 | 50 |
| |
50 | 51 |
| |
|
Lines changed: 14 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1035 | 1035 |
| |
1036 | 1036 |
| |
1037 | 1037 |
| |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
1038 | 1052 |
| |
1039 | 1053 |
| |
1040 | 1054 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
330 | 330 |
| |
331 | 331 |
| |
332 | 332 |
| |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
333 | 344 |
| |
334 | 345 |
| |
335 | 346 |
| |
|
0 commit comments
Comments
(0)