Re: Segment fault when excuting SPI function On PG with commit 41c6a5be

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Daniel Gustafsson <daniel@yesql.se>, "liuhuailing@fujitsu.com" <liuhuailing@fujitsu.com>, PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2021-08-10T07:09:11Z
Lists: pgsql-hackers
On Fri, Jul 30, 2021 at 11:22:43AM -0400, Tom Lane wrote:
> Happy to make it so.  Anyone have suggestions about the wording of
> the message?

For the archives, this has been applied as of ef12f32, and the new
message seems explicit enough:
+   if (unlikely(portal == NULL))
+       elog(ERROR, "cannot execute SQL without an outer snapshot or portal");
--
Michael

Commits

  1. Use elog, not Assert, to report failure to provide an outer snapshot.

  2. Restore the portal-level snapshot after procedure COMMIT/ROLLBACK.