Re: [PATCH] Fix improper tuple deallocation in import_pg_statist()

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Tomas Vondra <tomas@vondra.me>
Cc: yonghao_lee <yonghao_lee@qq.com>, pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-06T06:06:05Z
Lists: pgsql-hackers
On Thu, Mar 05, 2026 at 02:01:32AM +0100, Tomas Vondra wrote:
> Except that heap_freetuple is defined like this:
> 
> void
> heap_freetuple(HeapTuple htup)
> {
>     pfree(htup);
> }
> 
> so this does not change anything. This report seems to miss how tuples
> are allocated in heap_form_tuple.

Right, what is obviously an LLM analysis forgot the context of how
HeapTuple allocations happen when these are formed.

Saying that, this is new code, that I had the idea to commit like
this, and I don't like fresh inconsistencies.  We also use
heap_freetuple() in upsert_pg_statistic_ext_data().  Hence, at the
end, done.  It was harmless as-is, still..
--
Michael

Commits

  1. Fix inconsistency with HeapTuple freeing in extended_stats_funcs.c