From 802a4d411103f91e9b5a8507a379b89953ea1354 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Mon, 3 Feb 2003 14:04:24 +0000 Subject: [PATCH] Change MOVE LAST to MOVE ALL. Standard says FETCH LAST is after last row, and we don't do that. --- doc/src/sgml/ref/fetch.sgml | 23 ++++++----------------- doc/src/sgml/ref/move.sgml | 5 +++-- src/backend/parser/gram.y | 6 ++---- src/backend/parser/keywords.c | 3 +-- 4 files changed, 12 insertions(+), 25 deletions(-) diff --git a/doc/src/sgml/ref/fetch.sgml b/doc/src/sgml/ref/fetch.sgml index b67b7ef3c7..48363b5f4a 100644 --- a/doc/src/sgml/ref/fetch.sgml +++ b/doc/src/sgml/ref/fetch.sgml @@ -1,5 +1,5 @@ @@ -22,7 +22,7 @@ PostgreSQL documentation FETCH [ direction ] [ count ] { IN | FROM } cursor -FETCH [ FORWARD | BACKWARD | RELATIVE ] [ # | ALL | LAST | NEXT | PRIOR ] +FETCH [ FORWARD | BACKWARD | RELATIVE ] [ # | ALL | NEXT | PRIOR ] { IN | FROM } cursor @@ -105,17 +105,6 @@ FETCH [ FORWARD | BACKWARD | RELATIVE ] [ # - - - LAST - - - - Same as ALL, but conforms to SQL92 syntax. - - - - NEXT @@ -212,7 +201,7 @@ WARNING: FETCH/ABSOLUTE not supported, using RELATIVE If the number of rows remaining in the cursor is less than #, then only those available are fetched. - Substituting the keyword ALL or LAST in place of a number will + Substituting the keyword ALL in place of a number will cause all remaining rows in the cursor to be retrieved. Rows may be fetched in both FORWARD and BACKWARD directions. The default direction is FORWARD. @@ -220,13 +209,13 @@ WARNING: FETCH/ABSOLUTE not supported, using RELATIVE The cursor position can be before the first row of the query result, or on - any particular row of the result, or after the last row of the result. + any particular row of the result. When created, a cursor is positioned before the first row. After fetching some rows, the cursor is positioned on the last row retrieved. A new FETCH always steps one row in the specified direction (if possible) before beginning to return rows. If the FETCH requests more rows than available, the cursor is - left positioned after the last row of the query result (or before the first + left positioned on the last row of the query result (or on the first row, in the case of a backward fetch). This will always be the case after FETCH ALL. @@ -236,7 +225,7 @@ WARNING: FETCH/ABSOLUTE not supported, using RELATIVE A zero row count requests fetching the current row without moving the cursor --- that is, re-fetching the most recently fetched row. This will succeed unless the cursor is positioned before the - first row or after the last row; in which case, no row is returned. + first row; in which case, no row is returned. diff --git a/doc/src/sgml/ref/move.sgml b/doc/src/sgml/ref/move.sgml index 5b6f2671af..2d27e14442 100644 --- a/doc/src/sgml/ref/move.sgml +++ b/doc/src/sgml/ref/move.sgml @@ -1,5 +1,5 @@ @@ -34,7 +34,8 @@ MOVE [ direction ] [ MOVE allows the user to move the cursor position a - specified number of rows, or all the way to the end or start of the query. + specified number of rows, or to the beginning or end of the cursor. + MOVE ALL moves to the last row of the cursor. MOVE works exactly like the FETCH command, except it only repositions the cursor and does not return rows. diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y index 2d3c444520..22c07de7b5 100644 --- a/src/backend/parser/gram.y +++ b/src/backend/parser/gram.y @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.397 2003/02/02 23:46:38 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.398 2003/02/03 14:04:24 momjian Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -361,7 +361,7 @@ static void doNegateFloat(Value *v); KEY - LANCOMPILER LANGUAGE LAST LEADING LEFT LEVEL LIKE LIMIT + LANCOMPILER LANGUAGE LEADING LEFT LEVEL LIKE LIMIT LISTEN LOAD LOCAL LOCALTIME LOCALTIMESTAMP LOCATION LOCK_P @@ -2713,7 +2713,6 @@ fetch_how_many: Iconst { $$ = $1; } | '-' Iconst { $$ = - $2; } | ALL { $$ = INT_MAX; } - | LAST { $$ = INT_MAX; } | NEXT { $$ = 1; } | PRIOR { $$ = -1; } ; @@ -7131,7 +7130,6 @@ unreserved_keyword: | KEY | LANCOMPILER | LANGUAGE - | LAST | LEVEL | LISTEN | LOAD diff --git a/src/backend/parser/keywords.c b/src/backend/parser/keywords.c index 5373b974cb..4166825df8 100644 --- a/src/backend/parser/keywords.c +++ b/src/backend/parser/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.132 2002/12/12 20:35:13 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/keywords.c,v 1.133 2003/02/03 14:04:24 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -172,7 +172,6 @@ static const ScanKeyword ScanKeywords[] = { {"key", KEY}, {"lancompiler", LANCOMPILER}, {"language", LANGUAGE}, - {"last", LAST}, {"leading", LEADING}, {"left", LEFT}, {"level", LEVEL},