forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit520acab
committed
Set scan direction appropriately for SubPlans (bug #15336)
When executing a SubPlan in an expression, the EState's directionfield was left alone, resulting in an attempt to execute the subplanbackwards if it was encountered during a backwards scan of a cursor.Also, though much less likely, it was possible to reach the executionof an InitPlan while in backwards-scan state.Repair by saving/restoring estate->es_direction and forcing forwardscan mode in the relevant places.Backpatch all the way, since this has been broken since 8.3 (prior tocommitc7ff766, SubPlans had their own EStates rather than sharingthe parent plan's, so there was no confusion over scan direction).Per bug #15336 reported by Vladimir Baranoff; analysis and patch byme, review by Tom Lane.Discussion:https://postgr.es/m/153449812167.1304.1741624125628126322@wrigleys.postgresql.org1 parent9bed827 commit520acab
File tree
3 files changed
+57
-2
lines changed- src
- backend/executor
- test/regress
- expected
- sql
3 files changed
+57
-2
lines changedLines changed: 24 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
65 | 65 |
| |
66 | 66 |
| |
67 | 67 |
| |
| 68 | + | |
| 69 | + | |
| 70 | + | |
68 | 71 |
| |
69 | 72 |
| |
70 | 73 |
| |
| |||
77 | 80 |
| |
78 | 81 |
| |
79 | 82 |
| |
| 83 | + | |
| 84 | + | |
| 85 | + | |
80 | 86 |
| |
81 | 87 |
| |
82 |
| - | |
| 88 | + | |
83 | 89 |
| |
84 |
| - | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
85 | 96 |
| |
86 | 97 |
| |
87 | 98 |
| |
| |||
1006 | 1017 |
| |
1007 | 1018 |
| |
1008 | 1019 |
| |
| 1020 | + | |
| 1021 | + | |
1009 | 1022 |
| |
1010 | 1023 |
| |
1011 | 1024 |
| |
| |||
1019 | 1032 |
| |
1020 | 1033 |
| |
1021 | 1034 |
| |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
1022 | 1041 |
| |
1023 | 1042 |
| |
1024 | 1043 |
| |
| |||
1171 | 1190 |
| |
1172 | 1191 |
| |
1173 | 1192 |
| |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
1174 | 1196 |
| |
1175 | 1197 |
| |
1176 | 1198 |
| |
|
Lines changed: 17 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1137 | 1137 |
| |
1138 | 1138 |
| |
1139 | 1139 |
| |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + |
Lines changed: 16 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
609 | 609 |
| |
610 | 610 |
| |
611 | 611 |
| |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + |
0 commit comments
Comments
(0)