Use elog, not Assert, to report failure to provide an outer snapshot.
Tom Lane <tgl@sss.pgh.pa.us>
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/17035-14607d308ac8643c@postgresql.org
Files
| Path | Change | +/− |
|---|---|---|
| src/backend/tcop/pquery.c | modified | +2 −1 |
Discussion
- BUG #17035: assert after commit 8 messages · 2021-05-26 → 2021-05-27
- Segment fault when excuting SPI function On PG with commit 41c6a5be 9 messages · 2021-07-30 → 2021-08-10