aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pgstatfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-10-28 14:04:42 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2023-10-28 14:05:01 -0400
commit237f8765dfd9149471d37f3754d15cef888338a8 (patch)
tree6b9f988a6a704757ee4d49e95d009b10cc5ecd29 /src/backend/utils/adt/pgstatfuncs.c
parent4d42b4edc6def25cab63894a2d351d597606492d (diff)
downloadpostgresql-237f8765dfd9149471d37f3754d15cef888338a8.tar.gz
postgresql-237f8765dfd9149471d37f3754d15cef888338a8.zip
Fix intra-query memory leak when a SRF returns zero rows.
When looping around after finding that the set-returning function returned zero rows for the current input tuple, ExecProjectSet neglected to reset either of the two memory contexts it's responsible for cleaning out. Typically this wouldn't cause much problem, because once the SRF does return at least one row, the contexts would get reset on the next call. However, if the SRF returns no rows for many input tuples in succession, quite a lot of memory could be transiently consumed. To fix, make sure we reset both contexts while looping around. Per bug #18172 from Sergei Kornilov. Back-patch to all supported branches. Discussion: https://postgr.es/m/18172-9b8c5fc1d676ded3@postgresql.org
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
0 files changed, 0 insertions, 0 deletions