pgsql: Have the planner account for the Memoize cache key memory

2023-03-19 Thread David Rowley
Have the planner account for the Memoize cache key memory The Memoize executor node stores the cache key values along with the tuple(s) which were found in the outer node which match each key value, however, when the planner tried to estimate how many entries could be stored in the cache, it didn'

pgsql: Fix memory leak in Memoize cache key evaluation

2023-03-19 Thread David Rowley
Fix memory leak in Memoize cache key evaluation When probing the Memoize cache to check if the current cache key values exist in the cache, we perform an evaluation of the expressions making up the cache key before probing the hash table for those values. This operation could leak memory as it is

pgsql: Fix memory leak in Memoize cache key evaluation

2023-03-19 Thread David Rowley
Fix memory leak in Memoize cache key evaluation When probing the Memoize cache to check if the current cache key values exist in the cache, we perform an evaluation of the expressions making up the cache key before probing the hash table for those values. This operation could leak memory as it is

pgsql: Fix memory leak in Memoize cache key evaluation

2023-03-19 Thread David Rowley
Fix memory leak in Memoize cache key evaluation When probing the Memoize cache to check if the current cache key values exist in the cache, we perform an evaluation of the expressions making up the cache key before probing the hash table for those values. This operation could leak memory as it is

pgsql: Avoid copying undefined data in _readA_Const().

2023-03-19 Thread Tom Lane
Avoid copying undefined data in _readA_Const(). nodeRead() will have created a Node struct that's only allocated big enough for the specific node type, so copying sizeof(union ValUnion) can be copying too much. This provokes valgrind complaints, and with very bad luck could perhaps result in SIGS