- Notifications
You must be signed in to change notification settings - Fork28
Commit57868d9
committed
Avoid crash when rolling back within a prepared statement.
If a portal is used to run a prepared CALL or DO statement thatcontains a ROLLBACK, PortalRunMulti fails because the portal'sstatement list gets cleared by the rollback. (Since the grammardoesn't allow CALL/DO in PREPARE, the only easy way to get to this isvia extended query protocol, which treats all inputs as preparedstatements.) It's difficult to avoid resetting the portal earlybecause of resource-management issues, so work around this by teachingPortalRunMulti to be wary of portal->stmts having suddenly become NIL.The crash has only been seen to occur in v13 and HEAD (as aconsequence of commit1cff1b9 having added an extra touch ofportal->stmts). But even before that, the code involved touching aList that the portal no longer has any claim on. In the test case athand, the List will still exist because of another refcount on thecached plan; but I'm far from convinced that it's impossible for thecached plan to have been dropped by the time control gets back toPortalRunMulti. Hence, backpatch to v11 where nested transactionswere added.Thomas Munro and Tom Lane, per bug #16811 from James InformDiscussion:https://postgr.es/m/16811-c1b599b2c6c2d622@postgresql.org1 parent1d3ce02 commit57868d9
1 file changed
+18
-7
lines changedLines changed: 18 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1312 | 1312 |
| |
1313 | 1313 |
| |
1314 | 1314 |
| |
1315 |
| - | |
1316 |
| - | |
1317 |
| - | |
1318 |
| - | |
1319 |
| - | |
1320 |
| - | |
1321 |
| - | |
1322 | 1315 |
| |
1323 | 1316 |
| |
1324 | 1317 |
| |
1325 | 1318 |
| |
1326 | 1319 |
| |
1327 | 1320 |
| |
| 1321 | + | |
| 1322 | + | |
| 1323 | + | |
| 1324 | + | |
| 1325 | + | |
| 1326 | + | |
| 1327 | + | |
| 1328 | + | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
| 1334 | + | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
1328 | 1339 |
| |
1329 | 1340 |
| |
1330 | 1341 |
| |
|
0 commit comments
Comments
(0)