- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit12d18b4
committed
Fix WHERE CURRENT OF when the referenced cursor uses an index-only scan.
"UPDATE/DELETE WHERE CURRENT OF cursor_name" failed, with an error messagelike "cannot extract system attribute from virtual tuple", if the cursorwas using a index-only scan for the target table. Fix it by digging thecurrent TID out of the indexscan state.It seems likely that the same failure could occur for CustomScan plansand perhaps some FDW plan types, so that leaving this to be treated as aninternal error with an obscure message isn't as good an idea as it firstseemed. Hence, add a bit of heaptuple.c infrastructure to let us delivera more on-topic message. I chose to make the message match what you getfor the case where execCurrentOf can't identify the target scan node atall, "cursor "foo" is not a simply updatable scan of table "bar"".Perhaps it should be different, but we can always adjust that later.In the future, it might be nice to provide hooks that would let customscan providers and/or FDWs deal with this in other ways; but that'snot a suitable topic for a back-patchable bug fix.It's been like this all along, so back-patch to all supported branches.Yugo Nagata and Tom LaneDiscussion:https://postgr.es/m/20180201013349.937dfc5f.nagata@sraoss.co.jp1 parent5149dc9 commit12d18b4
File tree
5 files changed
+121
-20
lines changed- src
- backend
- access/common
- executor
- include/executor
- test/regress
- expected
- sql
5 files changed
+121
-20
lines changedLines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1299 | 1299 |
| |
1300 | 1300 |
| |
1301 | 1301 |
| |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
| 1305 | + | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
| 1311 | + | |
| 1312 | + | |
| 1313 | + | |
| 1314 | + | |
| 1315 | + | |
| 1316 | + | |
| 1317 | + | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
1302 | 1328 |
| |
1303 | 1329 |
| |
1304 | 1330 |
| |
|
Lines changed: 59 additions & 20 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| 15 | + | |
15 | 16 |
| |
16 | 17 |
| |
17 | 18 |
| |
| |||
149 | 150 |
| |
150 | 151 |
| |
151 | 152 |
| |
152 |
| - | |
153 |
| - | |
154 |
| - | |
155 |
| - | |
156 |
| - | |
157 | 153 |
| |
158 | 154 |
| |
159 | 155 |
| |
160 | 156 |
| |
161 | 157 |
| |
| 158 | + | |
| 159 | + | |
162 | 160 |
| |
163 | 161 |
| |
164 | 162 |
| |
| |||
183 | 181 |
| |
184 | 182 |
| |
185 | 183 |
| |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
194 |
| - | |
195 |
| - | |
196 |
| - | |
197 |
| - | |
198 |
| - | |
199 |
| - | |
200 |
| - | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
201 | 240 |
| |
202 | 241 |
| |
203 | 242 |
| |
|
Lines changed: 2 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
169 | 169 |
| |
170 | 170 |
| |
171 | 171 |
| |
| 172 | + | |
| 173 | + | |
172 | 174 |
| |
173 | 175 |
|
Lines changed: 24 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1245 | 1245 |
| |
1246 | 1246 |
| |
1247 | 1247 |
| |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
1248 | 1272 |
| |
1249 | 1273 |
| |
1250 | 1274 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
462 | 462 |
| |
463 | 463 |
| |
464 | 464 |
| |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
465 | 475 |
| |
466 | 476 |
| |
467 | 477 |
| |
|
0 commit comments
Comments
(0)