forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf245236
committed
Use per-tuple context in ExecGetAllUpdatedCols
Commitfc22b66 (generated columns) replaced ExecGetUpdatedCols() withExecGetAllUpdatedCols() in a couple places handling UPDATE (triggers andlock mode). However, ExecGetUpdatedCols() did exec_rt_fetch() whileExecGetAllUpdatedCols() also allocates memory through bms_union()without paying attention to the memory context and happened to use thelong-lived ExecutorState, leaking the memory until the end of the query.The amount of leaked memory is proportional to the number of (updated)attributes, types of UPDATE triggers, and the number of processed rows(which for UPDATE ... FROM ... may be much higher than updated rows).Fixed by switching to the per-tuple context in GetAllUpdatedColumns().This is fine for all in-core callers, but external callers may need tocopy the result. But we're not aware of any such callers.Note the issue was introduced byfc22b66, but the macros were laterrenamed byf50e888.Backpatch to 12, where the issue was introduced.Reported-by: Tomas VondraReviewed-by: Andres Freund, Tom Lane, Jakub WartakBackpatch-through: 12Discussion:https://postgr.es/m/222a3442-7f7d-246c-ed9b-a76209d19239@enterprisedb.com1 parentfb5a7d8 commitf245236
1 file changed
+17
-3
lines changedLines changed: 17 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1345 | 1345 |
| |
1346 | 1346 |
| |
1347 | 1347 |
| |
1348 |
| - | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
1349 | 1354 |
| |
1350 | 1355 |
| |
1351 | 1356 |
| |
1352 |
| - | |
1353 |
| - | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
1354 | 1368 |
| |
1355 | 1369 |
| |
1356 | 1370 |
| |
|
0 commit comments
Comments
(0)