Commit d297c91
committed
Avoid leaking memory while evaluating arguments for a table function.
ExecMakeTableFunctionResult evaluated the arguments for a function-in-FROM
in the query-lifespan memory context. This is insignificant in simple
cases where the function relation is scanned only once; but if the function
is in a sub-SELECT or is on the inside of a nested loop, any memory
consumed during argument evaluation can add up quickly. (The potential for
trouble here had been foreseen long ago, per existing comments; but we'd
not previously seen a complaint from the field about it.) To fix, create
an additional temporary context just for this purpose.
Per an example from MauMau. Back-patch to all active branches.1 parent 2f69338 commit d297c91
File tree
4 files changed
+29
-4
lines changed- src
- backend/executor
- include
- executor
- nodes
4 files changed
+29
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1935 | 1935 | | |
1936 | 1936 | | |
1937 | 1937 | | |
| 1938 | + | |
1938 | 1939 | | |
1939 | 1940 | | |
1940 | 1941 | | |
| |||
2013 | 2014 | | |
2014 | 2015 | | |
2015 | 2016 | | |
2016 | | - | |
2017 | | - | |
2018 | | - | |
2019 | | - | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
2020 | 2023 | | |
| 2024 | + | |
| 2025 | + | |
2021 | 2026 | | |
2022 | 2027 | | |
| 2028 | + | |
| 2029 | + | |
2023 | 2030 | | |
2024 | 2031 | | |
2025 | 2032 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| 68 | + | |
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
| |||
217 | 219 | | |
218 | 220 | | |
219 | 221 | | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
220 | 235 | | |
221 | 236 | | |
222 | 237 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| 191 | + | |
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1240 | 1240 | | |
1241 | 1241 | | |
1242 | 1242 | | |
| 1243 | + | |
1243 | 1244 | | |
1244 | 1245 | | |
1245 | 1246 | | |
| |||
1249 | 1250 | | |
1250 | 1251 | | |
1251 | 1252 | | |
| 1253 | + | |
1252 | 1254 | | |
1253 | 1255 | | |
1254 | 1256 | | |
| |||
0 commit comments