Index: doc/src/sgml/ref/move.sgml
===================================================================
RCS file: /cvsroot/pgsql-server/doc/src/sgml/ref/move.sgml,v
retrieving revision 1.13
diff -c -c -r1.13 move.sgml
*** doc/src/sgml/ref/move.sgml 21 Apr 2002 19:02:39 -0000 1.13
--- doc/src/sgml/ref/move.sgml 31 Oct 2002 01:15:42 -0000
***************
*** 21,27 ****
1999-07-20
! MOVE [ direction ] [ count ]
{ IN | FROM } cursor
--- 21,28 ----
1999-07-20
! MOVE [ direction ]
! {count | LAST }
{ IN | FROM } cursor
Index: src/backend/commands/portalcmds.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/commands/portalcmds.c,v
retrieving revision 1.3
diff -c -c -r1.3 portalcmds.c
*** src/backend/commands/portalcmds.c 4 Sep 2002 20:31:15 -0000 1.3
--- src/backend/commands/portalcmds.c 31 Oct 2002 01:15:44 -0000
***************
*** 15,20 ****
--- 15,22 ----
#include "postgres.h"
+ #include
+
#include "commands/portalcmds.h"
#include "executor/executor.h"
***************
*** 55,61 ****
*
* name: name of portal
* forward: forward or backward fetch?
! * count: # of tuples to fetch (0 implies all)
* dest: where to send results
* completionTag: points to a buffer of size COMPLETION_TAG_BUFSIZE
* in which to store a command completion status string.
--- 57,63 ----
*
* name: name of portal
* forward: forward or backward fetch?
! * count: # of tuples to fetch
* dest: where to send results
* completionTag: points to a buffer of size COMPLETION_TAG_BUFSIZE
* in which to store a command completion status string.
***************
*** 100,105 ****
--- 102,115 ----
return;
}
+ /* If zero count, we are done */
+ if (count == 0)
+ return;
+
+ /* Internally, zero count processes all portal rows */
+ if (count == INT_MAX)
+ count = 0;
+
/*
* switch into the portal context
*/
Index: src/backend/executor/execMain.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/executor/execMain.c,v
retrieving revision 1.180
diff -c -c -r1.180 execMain.c
*** src/backend/executor/execMain.c 14 Oct 2002 16:51:30 -0000 1.180
--- src/backend/executor/execMain.c 31 Oct 2002 01:15:50 -0000
***************
*** 1119,1125 ****
/*
* check our tuple count.. if we've processed the proper number
! * then quit, else loop again and process more tuples..
*/
current_tuple_count++;
if (numberTuples == current_tuple_count)
--- 1119,1126 ----
/*
* check our tuple count.. if we've processed the proper number
! * then quit, else loop again and process more tuples. Zero
! * number_tuples means no limit.
*/
current_tuple_count++;
if (numberTuples == current_tuple_count)
Index: src/backend/parser/gram.y
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/parser/gram.y,v
retrieving revision 2.370
diff -c -c -r2.370 gram.y
*** src/backend/parser/gram.y 22 Sep 2002 21:44:43 -0000 2.370
--- src/backend/parser/gram.y 31 Oct 2002 01:16:14 -0000
***************
*** 49,54 ****
--- 49,55 ----
#include "postgres.h"
#include
+ #include
#include "access/htup.h"
#include "catalog/index.h"
***************
*** 357,363 ****
JOIN
KEY
! LANCOMPILER LANGUAGE LEADING LEFT LEVEL LIKE LIMIT
LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION
LOCK_P
--- 358,364 ----
JOIN
KEY
! LANCOMPILER LANGUAGE LAST LEADING LEFT LEVEL LIKE LIMIT
LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION
LOCK_P
***************
*** 2644,2650 ****
if ($3 < 0)
{
$3 = -$3;
! $2 = (($2 == FORWARD)? BACKWARD: FORWARD);
}
n->direction = $2;
n->howMany = $3;
--- 2645,2651 ----
if ($3 < 0)
{
$3 = -$3;
! $2 = (($2 == FORWARD) ? BACKWARD: FORWARD);
}
n->direction = $2;
n->howMany = $3;
***************
*** 2712,2719 ****
fetch_how_many:
Iconst { $$ = $1; }
| '-' Iconst { $$ = - $2; }
! /* 0 means fetch all tuples*/
! | ALL { $$ = 0; }
| NEXT { $$ = 1; }
| PRIOR { $$ = -1; }
;
--- 2713,2720 ----
fetch_how_many:
Iconst { $$ = $1; }
| '-' Iconst { $$ = - $2; }
! | ALL { $$ = INT_MAX; }
! | LAST { $$ = INT_MAX; }
| NEXT { $$ = 1; }
| PRIOR { $$ = -1; }
;
***************
*** 7098,7103 ****
--- 7099,7105 ----
| KEY
| LANGUAGE
| LANCOMPILER
+ | LAST
| LEVEL
| LISTEN
| LOAD
Index: src/backend/parser/keywords.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/parser/keywords.c,v
retrieving revision 1.127
diff -c -c -r1.127 keywords.c
*** src/backend/parser/keywords.c 18 Sep 2002 21:35:22 -0000 1.127
--- src/backend/parser/keywords.c 31 Oct 2002 01:16:15 -0000
***************
*** 172,177 ****
--- 172,178 ----
{"key", KEY},
{"lancompiler", LANCOMPILER},
{"language", LANGUAGE},
+ {"last", LAST},
{"leading", LEADING},
{"left", LEFT},
{"level", LEVEL},
Index: src/backend/tcop/utility.c
===================================================================
RCS file: /cvsroot/pgsql-server/src/backend/tcop/utility.c,v
retrieving revision 1.180
diff -c -c -r1.180 utility.c
*** src/backend/tcop/utility.c 21 Oct 2002 20:31:52 -0000 1.180
--- src/backend/tcop/utility.c 31 Oct 2002 01:16:18 -0000
***************
*** 262,270 ****
forward = (bool) (stmt->direction == FORWARD);
/*
! * parser ensures that count is >= 0 and 'fetch ALL' -> 0
*/
-
count = stmt->howMany;
PerformPortalFetch(portalName, forward, count,
(stmt->ismove) ? None : dest,
--- 262,269 ----
forward = (bool) (stmt->direction == FORWARD);
/*
! * parser ensures that count is >= 0
*/
count = stmt->howMany;
PerformPortalFetch(portalName, forward, count,
(stmt->ismove) ? None : dest,