Re: "type with xxxx does not exist" when doing ExecMemoize()

Andrei Lepikhov <a.lepikhov@postgrespro.ru>

From: Andrei Lepikhov <a.lepikhov@postgrespro.ru>
To: Tender Wang <tndrwang@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>, David Rowley <dgrowleyml@gmail.com>
Date: 2024-02-28T07:25:04Z
Lists: pgsql-bugs, pgsql-hackers
On 28/2/2024 13:53, Tender Wang wrote:
> The attached patch is a new version based on v3(not including Andrei's 
> the test case). There is no need to call datumCopy when
> isnull is true.
> 
> I have not added a new runtime memoryContext so far. Continue to use 
> mstate->tableContext, I'm not sure the memory used of probeslot will 
> affect mstate->mem_limit.
> Maybe adding a new memoryContext is better. I think I should spend a 
> little time to learn nodeMemoize.c more deeply.
I am curious about your reasons to stay with tableContext. In terms of 
memory allocation, Richard's approach looks better.
Also, You don't need to initialize tts_values[i] at all if tts_isnull[i] 
set to true.

-- 
regards,
Andrei Lepikhov
Postgres Professional




Commits

  1. Fix incorrect accessing of pfree'd memory in Memoize

  2. Fix memory leak in Memoize code