Index: src/backend/commands/portalcmds.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/commands/portalcmds.c,v retrieving revision 1.44 diff -u -r1.44 portalcmds.c --- src/backend/commands/portalcmds.c 3 Nov 2005 17:11:35 -0000 1.44 +++ src/backend/commands/portalcmds.c 17 Dec 2005 11:44:29 -0000 @@ -395,7 +395,7 @@ if (!portal->atEnd) { - long store_pos; + uint64 store_pos; if (portal->posOverflow) /* oops, cannot trust portalPos */ ereport(ERROR, Index: src/backend/tcop/pquery.c =================================================================== RCS file: /projects/cvsroot/pgsql/src/backend/tcop/pquery.c,v retrieving revision 1.98 diff -u -r1.98 pquery.c --- src/backend/tcop/pquery.c 22 Nov 2005 18:17:21 -0000 1.98 +++ src/backend/tcop/pquery.c 17 Dec 2005 11:44:31 -0000 @@ -179,6 +179,7 @@ if (completionTag) { Oid lastOid; + char buf[21]; switch (operation) { @@ -190,16 +191,22 @@ lastOid = queryDesc->estate->es_lastoid; else lastOid = InvalidOid; + snprintf(buf, sizeof(buf), UINT64_FORMAT, + queryDesc->estate->es_processed); snprintf(completionTag, COMPLETION_TAG_BUFSIZE, - "INSERT %u %u", lastOid, queryDesc->estate->es_processed); + "INSERT %u %s", lastOid, buf); break; case CMD_UPDATE: + snprintf(buf, sizeof(buf), UINT64_FORMAT, + queryDesc->estate->es_processed); snprintf(completionTag, COMPLETION_TAG_BUFSIZE, - "UPDATE %u", queryDesc->estate->es_processed); + "UPDATE %s", buf); break; case CMD_DELETE: + snprintf(buf, sizeof(buf), UINT64_FORMAT, + queryDesc->estate->es_processed); snprintf(completionTag, COMPLETION_TAG_BUFSIZE, - "DELETE %u", queryDesc->estate->es_processed); + "DELETE %s", buf); break; default: strcpy(completionTag, "???"); @@ -536,7 +543,7 @@ * suspended due to exhaustion of the count parameter. */ bool -PortalRun(Portal portal, long count, +PortalRun(Portal portal, uint64 count, DestReceiver *dest, DestReceiver *altdest, char *completionTag) { @@ -736,15 +743,15 @@ * * Returns number of rows processed (suitable for use in result tag) */ -static long +static uint64 PortalRunSelect(Portal portal, bool forward, - long count, + uint64 count, DestReceiver *dest) { QueryDesc *queryDesc; ScanDirection direction; - uint32 nprocessed; + uint64 nprocessed; /* * NB: queryDesc will be NULL if we are fetching from a held cursor or a @@ -797,12 +804,11 @@ if (direction != NoMovementScanDirection) { - long oldPos; + uint64 oldPos; if (nprocessed > 0) portal->atStart = false; /* OK to go backward now */ - if (count == 0 || - (unsigned long) nprocessed < (unsigned long) count) + if (count == 0 || nprocessed < count) portal->atEnd = true; /* we retrieved 'em all */ oldPos = portal->portalPos; portal->portalPos += nprocessed; @@ -844,8 +850,7 @@ portal->atEnd = false; /* OK to go forward now */ portal->portalPos++; /* adjust for endpoint case */ } - if (count == 0 || - (unsigned long) nprocessed < (unsigned long) count) + if (count == 0 || nprocessed < count) { portal->atStart = true; /* we retrieved 'em all */ portal->portalPos = 0; @@ -853,7 +858,7 @@ } else { - long oldPos; + uint64 oldPos; oldPos = portal->portalPos; portal->portalPos -= nprocessed; @@ -879,11 +884,11 @@ * are run in the caller's memory context (since we have no estate). Watch * out for memory leaks. */ -static uint32 -RunFromStore(Portal portal, ScanDirection direction, long count, +static uint64 +RunFromStore(Portal portal, ScanDirection direction, uint64 count, DestReceiver *dest) { - long current_tuple_count = 0; + uint64 current_tuple_count = 0; TupleTableSlot *slot; slot = MakeSingleTupleTableSlot(portal->tupDesc); @@ -935,7 +940,7 @@ ExecDropSingleTupleTableSlot(slot); - return (uint32) current_tuple_count; + return current_tuple_count; } /* @@ -1239,10 +1244,10 @@ * * Returns number of rows processed (suitable for use in result tag) */ -static long +static uint64 DoPortalRunFetch(Portal portal, FetchDirection fdirection, - long count, + uint64 count, DestReceiver *dest) { bool forward; @@ -1278,7 +1283,7 @@ * we are. In any case, we arrange to fetch the target row * going forwards. */ - if (portal->posOverflow || portal->portalPos == LONG_MAX || + if (portal->posOverflow || portal->portalPos == ULLONG_MAX || count - 1 <= portal->portalPos / 2) { DoPortalRewind(portal); @@ -1288,7 +1293,7 @@ } else { - long pos = portal->portalPos; + uint64 pos = portal->portalPos; if (portal->atEnd) pos++; /* need one extra fetch if off end */ @@ -1400,7 +1405,7 @@ */ if (!forward && count == FETCH_ALL && dest->mydest == DestNone) { - long result = portal->portalPos; + uint64 result = portal->portalPos; if (result > 0 && !portal->atEnd) result--; Index: src/include/nodes/execnodes.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/include/nodes/execnodes.h,v retrieving revision 1.146 diff -u -r1.146 execnodes.h --- src/include/nodes/execnodes.h 2 Dec 2005 20:03:42 -0000 1.146 +++ src/include/nodes/execnodes.h 17 Dec 2005 11:44:40 -0000 @@ -318,7 +318,7 @@ TupleTable es_tupleTable; /* Array of TupleTableSlots */ - uint32 es_processed; /* # of tuples processed */ + uint64 es_processed; /* # of tuples processed */ Oid es_lastoid; /* last oid processed (by INSERT) */ List *es_rowMarks; /* not good place, but there is no other */ bool es_forUpdate; /* true = FOR UPDATE, false = FOR SHARE */ Index: src/include/utils/portal.h =================================================================== RCS file: /projects/cvsroot/pgsql/src/include/utils/portal.h,v retrieving revision 1.57 diff -u -r1.57 portal.h --- src/include/utils/portal.h 15 Oct 2005 02:49:46 -0000 1.57 +++ src/include/utils/portal.h 17 Dec 2005 11:44:50 -0000 @@ -165,7 +165,7 @@ bool atStart; bool atEnd; bool posOverflow; - long portalPos; + uint64 portalPos; } PortalData; /*