- Notifications
You must be signed in to change notification settings - Fork5
Commitc03ad56
committed
Fix inherited UPDATE/DELETE with UNION ALL subqueries.
Fix an oversight in commitb3aaf90: we doindeed need to process the planner's append_rel_list when copying RTEsubqueries, because if any of them were flattenable UNION ALL subqueries,the append_rel_list shows which subquery RTEs were pulled up out of whichother ones. Without this, UNION ALL subqueries aren't correctly insertedinto the update plans for inheritance child tables after the first one,typically resulting in no update happening for those child table(s).Per report from Victor Yegorov.Experimentation with this case also exposed a fault in commita7b9653: if an inherited UPDATE/DELETEwas proven totally dummy by constraint exclusion, we might arrive atadd_rtes_to_flat_rtable with root->simple_rel_array being NULL. Thisshould be interpreted as not having any RelOptInfos. I chose to codethe guard as a check against simple_rel_array_size, so as to alsoprovide some protection against indexing off the end of the array.Back-patch to 9.2 where the faulty code was added.1 parent60eea37 commitc03ad56
File tree
4 files changed
+38
-6
lines changed- src
- backend/optimizer/plan
- test/regress
- expected
- sql
4 files changed
+38
-6
lines changedLines changed: 8 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
848 | 848 |
| |
849 | 849 |
| |
850 | 850 |
| |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
851 | 858 |
| |
852 | 859 |
| |
853 | 860 |
| |
| |||
888 | 895 |
| |
889 | 896 |
| |
890 | 897 |
| |
| 898 | + | |
891 | 899 |
| |
892 | 900 |
| |
893 | 901 |
| |
| |||
896 | 904 |
| |
897 | 905 |
| |
898 | 906 |
| |
899 |
| - | |
900 | 907 |
| |
901 | 908 |
| |
902 | 909 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
280 | 280 |
| |
281 | 281 |
| |
282 | 282 |
| |
283 |
| - | |
| 283 | + | |
| 284 | + | |
284 | 285 |
| |
285 | 286 |
| |
286 | 287 |
| |
|
Lines changed: 19 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
557 | 557 |
| |
558 | 558 |
| |
559 | 559 |
| |
560 |
| - | |
561 |
| - | |
| 560 | + | |
562 | 561 |
| |
563 | 562 |
| |
564 | 563 |
| |
| |||
571 | 570 |
| |
572 | 571 |
| |
573 | 572 |
| |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
574 | 591 |
| |
575 | 592 |
| |
576 | 593 |
| |
|
Lines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
118 | 118 |
| |
119 | 119 |
| |
120 | 120 |
| |
121 |
| - | |
122 |
| - | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
123 | 130 |
| |
124 | 131 |
| |
125 | 132 |
| |
|
0 commit comments
Comments
(0)