Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef12f32

Browse files
committed
Use elog, not Assert, to report failure to provide an outer snapshot.
As of commit84f5c29, executing SQL commands (via SPI or otherwise)requires having either an active Portal, or a caller-establishedactive snapshot. We were simply Assert'ing that that's the case.But we've now had a couple different reports of people testingextensions that didn't meet this requirement, and were confused bythe 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.comDiscussion:https://postgr.es/m/17035-14607d308ac8643c@postgresql.org
1 parent89404a0 commitef12f32

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/backend/tcop/pquery.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1758,7 +1758,8 @@ EnsurePortalSnapshotExists(void)
17581758

17591759
/* Otherwise, we'd better have an active Portal */
17601760
portal=ActivePortal;
1761-
Assert(portal!=NULL);
1761+
if (unlikely(portal==NULL))
1762+
elog(ERROR,"cannot execute SQL without an outer snapshot or portal");
17621763
Assert(portal->portalSnapshot==NULL);
17631764

17641765
/* Create a new snapshot and make it active */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp