10
10
*
11
11
*
12
12
* IDENTIFICATION
13
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.129 2000/01/1806:12:03 momjian Exp $
13
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.130 2000/01/1819:08:13 momjian Exp $
14
14
*
15
15
* HISTORY
16
16
* AUTHORDATEMAJOR EVENT
@@ -156,7 +156,7 @@ static Node *doNegate(Node *n);
156
156
database_name ,access_method_clause ,access_method ,attr_name ,
157
157
class ,index_name ,name ,func_name ,file_name ,aggr_argtype
158
158
159
- %type <str> opt_id ,opt_portal_name ,
159
+ %type <str> opt_id ,
160
160
all_Op ,MathOp ,opt_name ,opt_unique ,
161
161
OptUseOp ,opt_class ,SpecialRuleRelation
162
162
@@ -199,7 +199,7 @@ static Node *doNegate(Node *n);
199
199
opt_with_copy ,index_opt_unique ,opt_verbose ,opt_analyze
200
200
%type <boolean> opt_cursor
201
201
202
- %type <ival> copy_dirn ,def_type ,opt_direction ,remove_type ,
202
+ %type <ival> copy_dirn ,def_type ,direction ,remove_type ,
203
203
opt_column ,event ,comment_type ,comment_cl ,
204
204
comment_ag ,comment_fn ,comment_op ,comment_tg
205
205
@@ -1861,7 +1861,7 @@ comment_text:Sconst { $$ = $1; }
1861
1861
*
1862
1862
*****************************************************************************/
1863
1863
1864
- FetchStmt :FETCH opt_direction fetch_how_many opt_portal_name
1864
+ FetchStmt :FETCH direction fetch_how_many from_in name
1865
1865
{
1866
1866
FetchStmt *n = makeNode(FetchStmt);
1867
1867
if ($2 == RELATIVE)
@@ -1877,11 +1877,60 @@ FetchStmt:FETCH opt_direction fetch_how_many opt_portal_name
1877
1877
}
1878
1878
n->direction =$2 ;
1879
1879
n->howMany =$3 ;
1880
+ n->portalname =$5 ;
1881
+ n->ismove =false ;
1882
+ $$ = (Node *)n;
1883
+ }
1884
+ | FETCH fetch_how_many from_in name
1885
+ {
1886
+ FetchStmt *n = makeNode(FetchStmt);
1887
+ if ($2 <0 )
1888
+ {
1889
+ n->howMany = -$2 ;
1890
+ n->direction = BACKWARD;
1891
+ }
1892
+ else
1893
+ {
1894
+ n->direction = FORWARD;
1895
+ n->howMany =$2 ;
1896
+ }
1897
+ n->portalname =$4 ;
1898
+ n->ismove =false ;
1899
+ $$ = (Node *)n;
1900
+ }
1901
+ | FETCH direction from_in name
1902
+ {
1903
+ FetchStmt *n = makeNode(FetchStmt);
1904
+ if ($2 == RELATIVE)
1905
+ {
1906
+ $2 = FORWARD;
1907
+ }
1908
+ n->direction =$2 ;
1909
+ n->howMany =1 ;
1880
1910
n->portalname =$4 ;
1881
1911
n->ismove =false ;
1882
1912
$$ = (Node *)n;
1883
1913
}
1884
- | MOVE opt_direction fetch_how_many opt_portal_name
1914
+ | FETCH from_in name
1915
+ {
1916
+ FetchStmt *n = makeNode(FetchStmt);
1917
+ n->direction = FORWARD;
1918
+ n->howMany =1 ;
1919
+ n->portalname =$3 ;
1920
+ n->ismove =false ;
1921
+ $$ = (Node *)n;
1922
+ }
1923
+ | FETCH name
1924
+ {
1925
+ FetchStmt *n = makeNode(FetchStmt);
1926
+ n->direction = FORWARD;
1927
+ n->howMany =1 ;
1928
+ n->portalname =$2 ;
1929
+ n->ismove =false ;
1930
+ $$ = (Node *)n;
1931
+ }
1932
+
1933
+ | MOVE direction fetch_how_many from_in name
1885
1934
{
1886
1935
FetchStmt *n = makeNode(FetchStmt);
1887
1936
if ($3 <0 )
@@ -1891,35 +1940,76 @@ FetchStmt:FETCH opt_direction fetch_how_many opt_portal_name
1891
1940
}
1892
1941
n->direction =$2 ;
1893
1942
n->howMany =$3 ;
1943
+ n->portalname =$5 ;
1944
+ n->ismove =TRUE ;
1945
+ $$ = (Node *)n;
1946
+ }
1947
+ | MOVE fetch_how_many from_in name
1948
+ {
1949
+ FetchStmt *n = makeNode(FetchStmt);
1950
+ if ($2 <0 )
1951
+ {
1952
+ n->howMany = -$2 ;
1953
+ n->direction = BACKWARD;
1954
+ }
1955
+ else
1956
+ {
1957
+ n->direction = FORWARD;
1958
+ n->howMany =$2 ;
1959
+ }
1894
1960
n->portalname =$4 ;
1895
1961
n->ismove =TRUE ;
1896
1962
$$ = (Node *)n;
1897
1963
}
1964
+ | MOVE direction from_in name
1965
+ {
1966
+ FetchStmt *n = makeNode(FetchStmt);
1967
+ n->direction =$2 ;
1968
+ n->howMany =1 ;
1969
+ n->portalname =$4 ;
1970
+ n->ismove =TRUE ;
1971
+ $$ = (Node *)n;
1972
+ }
1973
+ | MOVE from_in name
1974
+ {
1975
+ FetchStmt *n = makeNode(FetchStmt);
1976
+ n->direction = FORWARD;
1977
+ n->howMany =1 ;
1978
+ n->portalname =$3 ;
1979
+ n->ismove =TRUE ;
1980
+ $$ = (Node *)n;
1981
+ }
1982
+ | MOVE name
1983
+ {
1984
+ FetchStmt *n = makeNode(FetchStmt);
1985
+ n->direction = FORWARD;
1986
+ n->howMany =1 ;
1987
+ n->portalname =$2 ;
1988
+ n->ismove =TRUE ;
1989
+ $$ = (Node *)n;
1990
+ }
1898
1991
;
1899
1992
1900
- opt_direction :FORWARD {$$ = FORWARD; }
1993
+ direction :FORWARD {$$ = FORWARD; }
1901
1994
| BACKWARD {$$ = BACKWARD; }
1902
1995
| RELATIVE {$$ = RELATIVE; }
1903
1996
| ABSOLUTE
1904
1997
{
1905
1998
elog (NOTICE," FETCH/ABSOLUTE not supported, using RELATIVE" );
1906
1999
$$ = RELATIVE;
1907
2000
}
1908
- | /* EMPTY*/ {$$ = FORWARD;/* default*/ }
1909
2001
;
1910
2002
1911
2003
fetch_how_many :Iconst {$$ =$1 ; }
1912
2004
| ' -' Iconst {$$ = -$2 ; }
1913
2005
| ALL {$$ =0 ;/* 0 means fetch all tuples*/ }
1914
2006
| NEXT {$$ =1 ; }
1915
2007
| PRIOR {$$ = -1 ; }
1916
- | /* EMPTY*/ {$$ =1 ;/* default*/ }
1917
2008
;
1918
2009
1919
- opt_portal_name :IN name {$$ =$2 ; }
1920
- | FROM name {$$ =$2 ; }
1921
- | /* EMPTY*/ {$$ =NULL ; }
1922
- ;
2010
+ from_in :IN
2011
+ | FROM
2012
+ ;
1923
2013
1924
2014
1925
2015
/* ****************************************************************************