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

Commit0c400f1

Browse files
committed
PersistHoldablePortal must establish the correct value for ActiveSnapshot
while completing execution of the cursor's query. Otherwise we get wronganswers or even crashes from non-volatile functions called by the query.Per report from andrew@supernews.
1 parent72fd559 commit0c400f1

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

‎src/backend/commands/portalcmds.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.39 2005/03/25 21:57:58 tgl Exp $
17+
* $PostgreSQL: pgsql/src/backend/commands/portalcmds.c,v 1.40 2005/04/11 15:59:34 tgl Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -309,6 +309,7 @@ PersistHoldablePortal(Portal portal)
309309
{
310310
QueryDesc*queryDesc=PortalGetQueryDesc(portal);
311311
PortalsaveActivePortal;
312+
SnapshotsaveActiveSnapshot;
312313
ResourceOwnersaveResourceOwner;
313314
MemoryContextsavePortalContext;
314315
MemoryContextsaveQueryContext;
@@ -350,12 +351,14 @@ PersistHoldablePortal(Portal portal)
350351
* Set up global portal context pointers.
351352
*/
352353
saveActivePortal=ActivePortal;
354+
saveActiveSnapshot=ActiveSnapshot;
353355
saveResourceOwner=CurrentResourceOwner;
354356
savePortalContext=PortalContext;
355357
saveQueryContext=QueryContext;
356358
PG_TRY();
357359
{
358360
ActivePortal=portal;
361+
ActiveSnapshot=queryDesc->snapshot;
359362
CurrentResourceOwner=portal->resowner;
360363
PortalContext=PortalGetHeapMemory(portal);
361364
QueryContext=portal->queryContext;
@@ -428,6 +431,7 @@ PersistHoldablePortal(Portal portal)
428431

429432
/* Restore global vars and propagate error */
430433
ActivePortal=saveActivePortal;
434+
ActiveSnapshot=saveActiveSnapshot;
431435
CurrentResourceOwner=saveResourceOwner;
432436
PortalContext=savePortalContext;
433437
QueryContext=saveQueryContext;
@@ -442,6 +446,7 @@ PersistHoldablePortal(Portal portal)
442446
portal->status=PORTAL_READY;
443447

444448
ActivePortal=saveActivePortal;
449+
ActiveSnapshot=saveActiveSnapshot;
445450
CurrentResourceOwner=saveResourceOwner;
446451
PortalContext=savePortalContext;
447452
QueryContext=saveQueryContext;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp