pgsql: Use elog, not Assert, to report failure to provide an outer snap

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Use elog, not Assert, to report failure to provide an outer snap
Date: 2021-07-31 15:50:38
Message-ID: [email protected]
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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

As of commit 84f5c2908, executing SQL commands (via SPI or otherwise)
requires having either an active Portal, or a caller-established
active snapshot. We were simply Assert'ing that that's the case.
But we've now had a couple different reports of people testing
extensions that didn't meet this requirement, and were confused by
the resulting crash. Let's convert the Assert to a test-and-elog,
in hopes of making the issue clearer for extension authors.

Per gripes from Liu Huailing and RekGRpth. Back-patch to v11,
like the prior commit.

Discussion: https://postgr.es/m/OSZPR01MB6215671E3C5956A034A080DFBEEC9@OSZPR01MB6215.jpnprd01.prod.outlook.com
Discussion: https://postgr.es/m/[email protected]

Branch
------
REL_13_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/93f99693f9c2a8e0662d847c4ba2abed1628c1d8

Modified Files
--------------
src/backend/tcop/pquery.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2021-07-31 16:41:16 Re: pgsql: postgres_fdw: Fix handling of pending asynchronous requests.
Previous Message Etsuro Fujita 2021-07-31 14:16:14 Re: pgsql: postgres_fdw: Fix handling of pending asynchronous requests.