aboutsummaryrefslogtreecommitdiff
path: root/src/include/nodes/execnodes.h
diff options
context:
space:
mode:
authorAndrew Gierth <rhodiumtoad@postgresql.org>2018-08-13 01:45:35 +0100
committerAndrew Gierth <rhodiumtoad@postgresql.org>2018-08-13 01:59:45 +0100
commit07172d5aff8f43cd6ce09f57a0b56a535d7eaf45 (patch)
treed2925bdeb46287085e67d92d5d3869ae44dc512f /src/include/nodes/execnodes.h
parent46b5e7c4b5befbf6ac86d827a3a58f1f02c7338e (diff)
downloadpostgresql-07172d5aff8f43cd6ce09f57a0b56a535d7eaf45.tar.gz
postgresql-07172d5aff8f43cd6ce09f57a0b56a535d7eaf45.zip
Avoid query-lifetime memory leaks in XMLTABLE (bug #15321)
Multiple calls to XMLTABLE in a query (e.g. laterally applying it to a table with an xml column, an important use-case) were leaking large amounts of memory into the per-query context, blowing up memory usage. Repair by reorganizing memory context usage in nodeTableFuncscan; use the usual per-tuple context for row-by-row evaluations instead of perValueCxt, and use the explicitly created context -- renamed from perValueCxt to perTableCxt -- for arguments and state for each individual table-generation operation. Backpatch to PG10 where this code was introduced. Original report by IRC user begriffs; analysis and patch by me. Reviewed by Tom Lane and Pavel Stehule. Discussion: https://postgr.es/m/153394403528.10284.7530399040974170549@wrigleys.postgresql.org
Diffstat (limited to 'src/include/nodes/execnodes.h')
-rw-r--r--src/include/nodes/execnodes.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h
index 018f50bbb71..41fa2052a21 100644
--- a/src/include/nodes/execnodes.h
+++ b/src/include/nodes/execnodes.h
@@ -1580,7 +1580,7 @@ typedef struct TableFuncScanState
FmgrInfo *in_functions; /* input function for each column */
Oid *typioparams; /* typioparam for each column */
int64 ordinal; /* row number to be output next */
- MemoryContext perValueCxt; /* short life context for value evaluation */
+ MemoryContext perTableCxt; /* per-table context */
Tuplestorestate *tupstore; /* output tuple store */
} TableFuncScanState;