Commit 97f29c8
committed
The previous fix in CVS HEAD and 8.4 for handling the case where a cursor
being used in a PL/pgSQL FOR loop is closed was inadequate, as Tom Lane
pointed out. The bug affects FOR statement variants too, because you can
close an implicitly created cursor too by guessing the "<unnamed portal X>"
name created for it.
To fix that, "pin" the portal to prevent it from being dropped while it's
being used in a PL/pgSQL FOR loop. Backpatch all the way to 7.4 which is
the oldest supported version.1 parent 5e77769 commit 97f29c8
File tree
3 files changed
+58
-7
lines changed- src
- backend/utils/mmgr
- include/utils
- pl/plpgsql/src
3 files changed
+58
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
291 | 312 | | |
292 | 313 | | |
293 | 314 | | |
| |||
300 | 321 | | |
301 | 322 | | |
302 | 323 | | |
303 | | - | |
304 | | - | |
305 | | - | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
306 | 335 | | |
307 | 336 | | |
308 | 337 | | |
| |||
400 | 429 | | |
401 | 430 | | |
402 | 431 | | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
403 | 439 | | |
404 | 440 | | |
405 | 441 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | | - | |
| 42 | + | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| |||
169 | 170 | | |
170 | 171 | | |
171 | 172 | | |
| 173 | + | |
| 174 | + | |
172 | 175 | | |
173 | 176 | | |
174 | 177 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
1384 | 1384 | | |
1385 | 1385 | | |
1386 | 1386 | | |
1387 | | - | |
| 1387 | + | |
| 1388 | + | |
1388 | 1389 | | |
1389 | 1390 | | |
| 1391 | + | |
1390 | 1392 | | |
1391 | 1393 | | |
1392 | 1394 | | |
| |||
1425 | 1427 | | |
1426 | 1428 | | |
1427 | 1429 | | |
| 1430 | + | |
1428 | 1431 | | |
1429 | 1432 | | |
1430 | 1433 | | |
| |||
1471 | 1474 | | |
1472 | 1475 | | |
1473 | 1476 | | |
| 1477 | + | |
1474 | 1478 | | |
1475 | 1479 | | |
1476 | 1480 | | |
| |||
2227 | 2231 | | |
2228 | 2232 | | |
2229 | 2233 | | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
2230 | 2240 | | |
2231 | 2241 | | |
2232 | 2242 | | |
| |||
2267 | 2277 | | |
2268 | 2278 | | |
2269 | 2279 | | |
| 2280 | + | |
2270 | 2281 | | |
2271 | 2282 | | |
2272 | 2283 | | |
| |||
2313 | 2324 | | |
2314 | 2325 | | |
2315 | 2326 | | |
| 2327 | + | |
2316 | 2328 | | |
2317 | 2329 | | |
2318 | 2330 | | |
| |||
0 commit comments