forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit011eae6
committed
Fix error cleanup failure caused by 8.4 changes in plpgsql to try to avoid
memory leakage in error recovery. We were calling FreeExprContext, andtherefore invoking ExprContextCallback callbacks, in both normal and errorexits from subtransactions. However this isn't very safe, as shown inrecent trouble report from Frank van Vugt, in which releasing a tupledescrefcount failed. It's also unnecessary, since the resources that callbacksmight wish to release should be cleaned up by other error recovery mechanisms(ie the resource owners). We only really want FreeExprContext to releasememory attached to the exprcontext in the error-exit case. So, add a boolparameter to FreeExprContext to tell it not to call the callbacks.A more general solution would be to pass the isCommit bool parameter on tothe callbacks, so they could do only safe things during error exit. Butthat would make the patch significantly more invasive and possibly breakthird-party code that registers ExprContextCallback callbacks. We might wantto do that later in HEAD, but for now I'll just do what seems reasonable toback-patch.1 parentfb18055 commit011eae6
File tree
5 files changed
+28
-17
lines changed- src
- backend/executor
- include/executor
- pl/plpgsql/src
5 files changed
+28
-17
lines changedLines changed: 18 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 |
| - | |
| 71 | + | |
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
| |||
257 | 257 |
| |
258 | 258 |
| |
259 | 259 |
| |
260 |
| - | |
| 260 | + | |
| 261 | + | |
261 | 262 |
| |
262 | 263 |
| |
263 | 264 |
| |
| |||
408 | 409 |
| |
409 | 410 |
| |
410 | 411 |
| |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
411 | 417 |
| |
412 | 418 |
| |
413 | 419 |
| |
414 | 420 |
| |
415 |
| - | |
| 421 | + | |
416 | 422 |
| |
417 | 423 |
| |
418 | 424 |
| |
419 | 425 |
| |
420 |
| - | |
| 426 | + | |
421 | 427 |
| |
422 | 428 |
| |
423 | 429 |
| |
| |||
442 | 448 |
| |
443 | 449 |
| |
444 | 450 |
| |
445 |
| - | |
| 451 | + | |
446 | 452 |
| |
447 | 453 |
| |
448 | 454 |
| |
| |||
1222 | 1228 |
| |
1223 | 1229 |
| |
1224 | 1230 |
| |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
1225 | 1234 |
| |
1226 | 1235 |
| |
1227 |
| - | |
| 1236 | + | |
1228 | 1237 |
| |
1229 | 1238 |
| |
1230 | 1239 |
| |
| |||
1245 | 1254 |
| |
1246 | 1255 |
| |
1247 | 1256 |
| |
1248 |
| - | |
| 1257 | + | |
| 1258 | + | |
1249 | 1259 |
| |
1250 | 1260 |
| |
1251 | 1261 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
182 | 182 |
| |
183 | 183 |
| |
184 | 184 |
| |
185 |
| - | |
| 185 | + | |
186 | 186 |
| |
187 | 187 |
| |
188 | 188 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
423 | 423 |
| |
424 | 424 |
| |
425 | 425 |
| |
426 |
| - | |
| 426 | + | |
427 | 427 |
| |
428 | 428 |
| |
429 | 429 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
10 |
| - | |
| 10 | + | |
11 | 11 |
| |
12 | 12 |
| |
13 | 13 |
| |
| |||
255 | 255 |
| |
256 | 256 |
| |
257 | 257 |
| |
258 |
| - | |
| 258 | + | |
259 | 259 |
| |
260 | 260 |
| |
261 | 261 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
8 | 8 |
| |
9 | 9 |
| |
10 | 10 |
| |
11 |
| - | |
| 11 | + | |
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| |||
5237 | 5237 |
| |
5238 | 5238 |
| |
5239 | 5239 |
| |
5240 |
| - | |
| 5240 | + | |
5241 | 5241 |
| |
5242 | 5242 |
| |
5243 | 5243 |
| |
| |||
5292 | 5292 |
| |
5293 | 5293 |
| |
5294 | 5294 |
| |
5295 |
| - | |
| 5295 | + | |
| 5296 | + | |
5296 | 5297 |
| |
5297 | 5298 |
| |
5298 | 5299 |
| |
|
0 commit comments
Comments
(0)