Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f1f2b27

Browse files
committed
Fix portal management code to support non-default command completion tags for
portals using PORTAL_UTIL_SELECT strategy. This is currently significant only for FETCH queries, which are supposed to include a count in the tag. Seems it's been broken since 7.4, but nobody noticed before Knut Lehre.
1 parent aa728d5 commit f1f2b27

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/backend/tcop/pquery.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.112 2007/01/05 22:19:39 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/tcop/pquery.c,v 1.113 2007/02/18 19:49:25 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -919,6 +919,8 @@ FillPortalStore(Portal portal)
919919
PortalCreateHoldStore(portal);
920920
treceiver = CreateDestReceiver(DestTuplestore, portal);
921921

922+
completionTag[0] = '\0';
923+
922924
switch (portal->strategy)
923925
{
924926
case PORTAL_ONE_RETURNING:
@@ -929,13 +931,11 @@ FillPortalStore(Portal portal)
929931
* tuplestore. Auxiliary query outputs are discarded.
930932
*/
931933
PortalRunMulti(portal, treceiver, None_Receiver, completionTag);
932-
/* Override default completion tag with actual command result */
933-
portal->commandTag = pstrdup(completionTag);
934934
break;
935935

936936
case PORTAL_UTIL_SELECT:
937937
PortalRunUtility(portal, linitial(portal->parseTrees),
938-
treceiver, NULL);
938+
treceiver, completionTag);
939939
break;
940940

941941
default:
@@ -944,6 +944,10 @@ FillPortalStore(Portal portal)
944944
break;
945945
}
946946

947+
/* Override default completion tag with actual command result */
948+
if (completionTag[0] != '\0')
949+
portal->commandTag = pstrdup(completionTag);
950+
947951
(*treceiver->rDestroy) (treceiver);
948952
}
949953

0 commit comments

Comments
 (0)