1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-15 19:21:59 +03:00

Make MOVE/FETCH 0 actually move/fetch 0. Add MOVE LAST to move to end

of cursor.
This commit is contained in:
Bruce Momjian
2002-11-13 00:44:09 +00:00
parent 9b12ab6d5d
commit 4e5a947d1c
8 changed files with 36 additions and 21 deletions

View File

@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.376 2002/11/11 22:19:23 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.377 2002/11/13 00:44:08 momjian Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
@ -49,6 +49,7 @@
#include "postgres.h"
#include <ctype.h>
#include <limits.h>
#include "access/htup.h"
#include "catalog/index.h"
@ -358,7 +359,7 @@ static void doNegateFloat(Value *v);
KEY
LANCOMPILER LANGUAGE LEADING LEFT LEVEL LIKE LIMIT
LANCOMPILER LANGUAGE LAST LEADING LEFT LEVEL LIKE LIMIT
LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION
LOCK_P
@ -2661,7 +2662,7 @@ FetchStmt: FETCH direction fetch_how_many from_in name
if ($3 < 0)
{
$3 = -$3;
$2 = (($2 == FORWARD)? BACKWARD: FORWARD);
$2 = (($2 == FORWARD) ? BACKWARD: FORWARD);
}
n->direction = $2;
n->howMany = $3;
@ -2729,8 +2730,8 @@ direction: FORWARD { $$ = FORWARD; }
fetch_how_many:
Iconst { $$ = $1; }
| '-' Iconst { $$ = - $2; }
/* 0 means fetch all tuples*/
| ALL { $$ = 0; }
| ALL { $$ = INT_MAX; }
| LAST { $$ = INT_MAX; }
| NEXT { $$ = 1; }
| PRIOR { $$ = -1; }
;
@ -7060,6 +7061,7 @@ unreserved_keyword:
| KEY
| LANGUAGE
| LANCOMPILER
| LAST
| LEVEL
| LISTEN
| LOAD

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.129 2002/11/11 22:19:23 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.130 2002/11/13 00:44:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@ -172,6 +172,7 @@ static const ScanKeyword ScanKeywords[] = {
{"key", KEY},
{"lancompiler", LANCOMPILER},
{"language", LANGUAGE},
{"last", LAST},
{"leading", LEADING},
{"left", LEFT},
{"level", LEVEL},