Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cee82fa

Browse files
author
Michael Meskes
committed
- Synced preproc.y with gram.y.
- Applied bug fix by John Summerfield.
1 parent 2938eec commit cee82fa

File tree

3 files changed

+43
-16
lines changed

3 files changed

+43
-16
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,5 +1079,10 @@ Fri Jun 1 08:13:25 CEST 2001
10791079
- Synced preproc.y with gram.y.
10801080
- Synced pgc.l with scan.l.
10811081
- Synced keyword.c.
1082+
1083+
Wed Jun 13 14:39:12 CEST 2001
1084+
1085+
- Synced preproc.y with gram.y.
1086+
- Applied bug fix by John Summerfield.
10821087
- Set ecpg version to 2.9.0.
10831088
- Set library version to 3.3.0.

src/interfaces/ecpg/preproc/pgc.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.78 2001/04/02 08:17:24 meskes Exp $
15+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.79 2001/06/13 12:38:58 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -896,7 +896,7 @@ lex_init(void)
896896
braces_open = 0;
897897

898898
preproc_tos = 0;
899-
yylineno = 0;
899+
yylineno = 1;
900900
ifcond = TRUE;
901901
stacked_if_value[preproc_tos].condition = ifcond;
902902
stacked_if_value[preproc_tos].else_branch = FALSE;

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 36 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ make_name(void)
337337
%type <str> constraints_set_mode comment_type comment_cl comment_ag
338338
%type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete
339339
%type <str> opt_force key_update CreateSchemaStmt PosIntStringConst
340-
%type <str> IntConst PosIntConst
340+
%type <str> IntConst PosIntConst grantee_list func_type
341341
%type <str> select_limit opt_for_update_clause CheckPointStmt
342342

343343
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen
@@ -852,6 +852,10 @@ VariableShowStmt: SHOW ColId
852852
{
853853
$$ = make_str("show time zone");
854854
}
855+
| SHOW ALL
856+
{
857+
$$ = make_str("show all");
858+
}
855859
| SHOW TRANSACTION ISOLATION LEVEL
856860
{
857861
$$ = make_str("show transaction isolation level");
@@ -870,6 +874,10 @@ VariableResetStmt: RESET ColId
870874
{
871875
$$ = make_str("reset transaction isolation level");
872876
}
877+
| RESET ALL
878+
{
879+
$$ = make_str("reset all");
880+
}
873881
;
874882

875883
ConstraintsSetStmt: SET CONSTRAINTS constraints_set_list constraints_set_mode
@@ -1681,11 +1689,11 @@ comment_text: StringConst { $$ = $1; }
16811689
/*****************************************************************************
16821690
*
16831691
* QUERY:
1684-
* GRANT [privileges] ON [relation_name_list] TO [GROUP] grantee
1692+
* GRANT [privileges] ON [TABLE] relation_name_list TO [GROUP] grantee, ...
16851693
*
16861694
*****************************************************************************/
16871695

1688-
GrantStmt: GRANT privileges ON opt_table relation_name_list TO grantee opt_with_grant
1696+
GrantStmt: GRANT privileges ON opt_table relation_name_list TO grantee_list opt_with_grant
16891697
{
16901698
$$ = cat_str(8, make_str("grant"), $2, make_str("on"), $4, $5, make_str("to"), $7);
16911699
}
@@ -1759,6 +1767,10 @@ grantee: PUBLIC
17591767
}
17601768
;
17611769

1770+
grantee_list: grantee { $$ = $1; }
1771+
| grantee_list ',' grantee { $$ = cat_str(3, $1, make_str(","), $3); }
1772+
;
1773+
17621774
opt_with_grant: WITH GRANT OPTION
17631775
{
17641776
mmerror(ET_ERROR, "WITH GRANT OPTION is not supported. Only relation owners can set privileges");
@@ -1770,11 +1782,11 @@ opt_with_grant: WITH GRANT OPTION
17701782
/*****************************************************************************
17711783
*
17721784
* QUERY:
1773-
* REVOKE [privileges] ON [relation_name] FROM [user]
1785+
* REVOKE privileges ON [TABLE relation_name_list FROM [user], ...
17741786
*
17751787
*****************************************************************************/
17761788

1777-
RevokeStmt: REVOKE privileges ON opt_table relation_name_list FROM grantee
1789+
RevokeStmt: REVOKE privileges ON opt_table relation_name_list FROM grantee_list
17781790
{
17791791
$$ = cat_str(8, make_str("revoke"), $2, make_str("on"), $4, $5, make_str("from"), $7);
17801792
}
@@ -1914,15 +1926,15 @@ func_args_list: func_arg { $$ = $1; }
19141926
{ $$ = cat_str(3, $1, make_str(","), $3); }
19151927
;
19161928

1917-
func_arg: opt_arg Typename
1929+
func_arg: opt_arg func_type
19181930
{
19191931
/* We can catch over-specified arguments here if we want to,
19201932
* but for now better to silently swallow typmod, etc.
19211933
* - thomas 2000-03-22
19221934
*/
19231935
$$ = cat2_str($1, $2);
19241936
}
1925-
| Typename
1937+
| func_type
19261938
{
19271939
$$ = $1;
19281940
}
@@ -1944,7 +1956,7 @@ opt_arg: IN { $$ = make_str("in"); }
19441956
func_as: StringConst { $$ = $1; }
19451957
| StringConst ',' StringConst { $$ = cat_str(3, $1, make_str(","), $3); }
19461958

1947-
func_return: Typename
1959+
func_return: func_type
19481960
{
19491961
/* We can catch over-specified arguments here if we want to,
19501962
* but for now better to silently swallow typmod, etc.
@@ -1954,6 +1966,16 @@ func_return: Typename
19541966
}
19551967
;
19561968

1969+
func_type: Typename
1970+
{
1971+
$$ = $1;
1972+
}
1973+
| IDENT '.' ColId '%' TYPE_P
1974+
{
1975+
$$ = cat_str(4, $1, make_str("."), $3, make_str("% type"));
1976+
}
1977+
;
1978+
19571979
/*****************************************************************************
19581980
*
19591981
* QUERY:
@@ -3869,7 +3891,7 @@ connection_target: database_name opt_server opt_port
38693891
/* old style: dbname[@server][:port] */
38703892
if (strlen($2) > 0 && *($2) != '@')
38713893
{
3872-
sprintf(errortext, "parse error at or near '%s'", $2);
3894+
sprintf(errortext, "Expected '@', found '%s'", $2);
38733895
mmerror(ET_ERROR, errortext);
38743896
}
38753897

@@ -3880,7 +3902,7 @@ connection_target: database_name opt_server opt_port
38803902
/* new style: <tcp|unix>:postgresql://server[:port][/dbname] */
38813903
if (strncmp($3, "//", strlen("//")) != 0)
38823904
{
3883-
sprintf(errortext, "parse error at or near '%s'", $3);
3905+
sprintf(errortext, "Expected '://', found '%s'", $3);
38843906
mmerror(ET_ERROR, errortext);
38853907
}
38863908

@@ -3926,7 +3948,7 @@ db_prefix: ident cvariable
39263948
{
39273949
if (strcmp($2, "postgresql") != 0 && strcmp($2, "postgres") != 0)
39283950
{
3929-
sprintf(errortext, "parse error at or near '%s'", $2);
3951+
sprintf(errortext, "Expected 'postgresql', found '%s'", $2);
39303952
mmerror(ET_ERROR, errortext);
39313953
}
39323954

@@ -3943,7 +3965,7 @@ server: Op server_name
39433965
{
39443966
if (strcmp($1, "@") != 0 && strcmp($1, "//") != 0)
39453967
{
3946-
sprintf(errortext, "parse error at or near '%s'", $1);
3968+
sprintf(errortext, "Expected '@' or '://', found '%s'", $1);
39473969
mmerror(ET_ERROR, errortext);
39483970
}
39493971

@@ -4037,11 +4059,11 @@ char_variable: cvariable
40374059
opt_options: Op ColId
40384060
{
40394061
if (strlen($1) == 0)
4040-
mmerror(ET_ERROR, "parse error");
4062+
mmerror(ET_ERROR, "incomplete statement");
40414063

40424064
if (strcmp($1, "?") != 0)
40434065
{
4044-
sprintf(errortext, "parse error at or near %s", $1);
4066+
sprintf(errortext, "unrecognised token '%s'", $1);
40454067
mmerror(ET_ERROR, errortext);
40464068
}
40474069

0 commit comments

Comments
 (0)