Re: BUG #19073: there are meaningless code in _SPI_execute_plan() when canSetTag is true
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Euler Taveira" <euler@eulerto.com>
Cc: webbohan@qq.com, pgsql-bugs@lists.postgresql.org
Date: 2025-10-05T15:48:33Z
Lists: pgsql-bugs
"Euler Taveira" <euler@eulerto.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