aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeModifyTable.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2023-04-24 14:19:46 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2023-04-24 14:19:46 -0400
commit441ee1677e6b580794c81943a937cd84363672f3 (patch)
tree29a6d8a2af1fd7ec93def1a8fa10b11e9876959e /src/backend/executor/nodeModifyTable.c
parentfce3b26e97ca98de054734e2af7d9125661a9b3f (diff)
downloadpostgresql-441ee1677e6b580794c81943a937cd84363672f3.tar.gz
postgresql-441ee1677e6b580794c81943a937cd84363672f3.zip
Fix memory leakage in plpgsql DO blocks that use cast expressions.
Commit 04fe805a1 modified plpgsql so that datatype casts make use of expressions cached by plancache.c, in place of older code where these expression trees were managed by plpgsql itself. However, I (tgl) forgot that we use a separate, shorter-lived cast info hashtable in DO blocks. The new mechanism thus resulted in session-lifespan leakage of the plancache data once a DO block containing one or more casts terminated. To fix, split the cast hash table into two parts, one that tracks only the plancache's CachedExpressions and one that tracks the expression state trees generated from them. DO blocks need their own expression state trees and hence their own version of the second hash table, but there's no reason they can't share the CachedExpressions with regular plpgsql functions. Per report from Ajit Awekar. Back-patch to v12 where the issue was introduced. Ajit Awekar and Tom Lane Discussion: https://postgr.es/m/CAHv6PyrNaqdvyWUspzd3txYQguFTBSnhx+m6tS06TnM+KWc_LQ@mail.gmail.com
Diffstat (limited to 'src/backend/executor/nodeModifyTable.c')
0 files changed, 0 insertions, 0 deletions