From: | "Euler Taveira" <euler(at)eulerto(dot)com> |
---|---|
To: | webbohan(at)qq(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #19073: there are meaningless code in _SPI_execute_plan() when canSetTag is true |
Date: | 2025-10-05 14:47:59 |
Message-ID: | 5b04da16-c2de-464b-8677-9e4991b28e55@app.fastmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Sat, Oct 4, 2025, at 11:29 PM, PG Bug reporting form wrote:
> In function _SPI_execute_plan(), `my_tuptable` is local variable and
> initialized as NULL.
> If plan is canSetTag subqueries, `SPI_freetuptable(my_tuptable)` is
> meaningless, because `my_tuptable` is NULL.
> We'd better remove this code.
>
There could be multiple statements. The first case will call SPI_freetuptable()
and it is a noop. The code path you are referring to is inside a foreach loop
and a previous statement might set my_tuptable and needs to be freed before
reusing it. That's exactly what the comment says.
/*
* The last canSetTag query sets the status values returned to the
* caller. Be careful to free any tuptables not returned, to
* avoid intra-transaction memory leak.
*/
if (canSetTag)
{
my_processed = _SPI_current->processed;
SPI_freetuptable(my_tuptable);
my_tuptable = _SPI_current->tuptable;
my_res = res;
}
--
Euler Taveira
EDB https://www.enterprisedb.com/
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2025-10-05 15:48:33 | Re: BUG #19073: there are meaningless code in _SPI_execute_plan() when canSetTag is true |
Previous Message | Thom Brown | 2025-10-05 10:51:19 | Re: Potential "AIO / io workers" inter-worker locking issue in PG18? |