Re: BUG #19073: there are meaningless code in _SPI_execute_plan() when canSetTag is true

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Euler Taveira" <euler(at)eulerto(dot)com>
Cc: 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 15:48:33
Message-ID: 1680816.1759679313@sss.pgh.pa.us
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

"Euler Taveira" <euler(at)eulerto(dot)com> writes:
> On Sat, Oct 4, 2025, at 11:29 PM, PG Bug reporting form wrote:
>> If plan is canSetTag subqueries, `SPI_freetuptable(my_tuptable)` is
>> meaningless, because `my_tuptable` is NULL.

> 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.

Yeah. You'd only reach this case if there were multiple SQL
statements in the string given to SPI_execute() or similar,
but that's perfectly legal.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Etsuro Fujita 2025-10-05 17:15:25 Re: TRAP: failed Assert("outerPlan != NULL") in postgres_fdw.c
Previous Message Euler Taveira 2025-10-05 14:47:59 Re: BUG #19073: there are meaningless code in _SPI_execute_plan() when canSetTag is true