Skip to content

Commit 1ebc028

Browse files
author
Michael Meskes
committed
- Fixed GRANT statement.
- Synced preproc.y with gram.y.
1 parent e482dcb commit 1ebc028

File tree

2 files changed

+41
-43
lines changed

2 files changed

+41
-43
lines changed

src/interfaces/ecpg/ChangeLog

+9-5
Original file line numberDiff line numberDiff line change
@@ -1102,28 +1102,32 @@ Tue Sep 25 20:10:03 CEST 2001
11021102
- Synced preproc.y with gram.y.
11031103
- Changed locale handling.
11041104

1105-
Mon Okt 1 13:49:40 CEST 2001
1105+
Mon Oct 1 13:49:40 CEST 2001
11061106

11071107
- Fixed truncate bug.
11081108
- Added patch by Christof Petig <[email protected]> to clean up
11091109
ecpglib.
11101110

1111-
TUe Okt 2 16:09:26 CEST 2001
1111+
TUe Oct 2 16:09:26 CEST 2001
11121112

11131113
- Re-added Tom's patch fixing my setlocale patch. I accidently
11141114
deleted it.
11151115

1116-
Fri Okt 5 08:37:01 CEST 2001
1116+
Fri Oct 5 08:37:01 CEST 2001
11171117

11181118
- Fixed yet another typo in preproc.y.
11191119

1120-
Fri Okt 5 19:33:46 CEST 2001
1120+
Fri Oct 5 19:33:46 CEST 2001
11211121

11221122
- Make sure every call to ECPGraise is logged.
11231123

1124-
Mon Okt 8 10:10:23 CEST 2001
1124+
Mon Oct 8 10:10:23 CEST 2001
11251125

11261126
- Fix include file so library is binary compatible again.
11271127

1128+
Sun Oct 14 14:07:59 CEST 2001
1129+
1130+
- Fixed GRANT statement.
1131+
- Synced preproc.y with gram.y.
11281132
- Set ecpg version to 2.9.0.
11291133
- Set library version to 3.3.0.

src/interfaces/ecpg/preproc/preproc.y

+32-38
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ make_name(void)
192192
PARTIAL, PATH_P, POSITION, PRECISION, PRIMARY, PRIOR, PRIVILEGES, PROCEDURE, PUBLIC,
193193
READ, REFERENCES, RELATIVE, REVOKE, RIGHT, ROLLBACK,
194194
SCHEMA, SCROLL, SECOND_P, SELECT, SESSION, SESSION_USER, SET, SOME, SUBSTRING,
195-
TABLE, TEMPORARY, THEN, TIME, TIMESTAMP, TIMEZONE_HOUR,
196-
TIMEZONE_MINUTE, TO, TRAILING, TRANSACTION, TRIM, TRUE_P,
195+
TABLE, TEMPORARY, THEN, TIME, TIMESTAMP
196+
TO, TRAILING, TRANSACTION, TRIM, TRUE_P,
197197
UNENCRYPTED, UNION, UNIQUE, UNKNOWN, UPDATE, USER, USING,
198198
VALUES, VARCHAR, VARYING, VIEW,
199199
WHEN, WHERE, WITH, WITHOUT, WORK, YEAR_P, ZONE
@@ -335,7 +335,7 @@ make_name(void)
335335
%type <str> opt_level opt_lock lock_type OptGroupList OptGroupElem
336336
%type <str> OptConstrFromTable OptTempTableName StringConst
337337
%type <str> constraints_set_list constraints_set_namelist
338-
%type <str> constraints_set_mode comment_type
338+
%type <str> constraints_set_mode comment_type opt_empty_parentheses
339339
%type <str> CreateGroupStmt AlterGroupStmt DropGroupStmt key_delete
340340
%type <str> opt_force key_update CreateSchemaStmt PosIntStringConst
341341
%type <str> IntConst PosIntConst grantee_list func_type opt_or_replace
@@ -1693,7 +1693,7 @@ comment_text: StringConst { $$ = $1; }
16931693

16941694
GrantStmt: GRANT privileges ON opt_table relation_name_list TO grantee_list opt_with_grant
16951695
{
1696-
$$ = cat_str(8, make_str("grant"), $2, make_str("on"), $4, $5, make_str("to"), $7);
1696+
$$ = cat_str(7, make_str("grant"), $2, make_str("on"), $4, $5, make_str("to"), $7);
16971697
}
16981698
;
16991699

@@ -3064,19 +3064,19 @@ bit: BIT opt_varying
30643064
* The following implements CHAR() and VARCHAR().
30653065
* - ay 6/95
30663066
*/
3067-
Character: character '(' PosIntConst ')'
3067+
Character: character '(' PosIntConst ')' opt_charset
30683068
{
3069-
$$ = cat_str(4, $1, make_str("("), $3, make_str(")"));
3069+
$$ = cat_str(5, $1, make_str("("), $3, make_str(")"), $5);
30703070
}
3071-
| character
3071+
| character opt_charset
30723072
{
3073-
$$ = $1;
3073+
$$ = cat2_str($1, $2);
30743074
}
30753075
;
30763076

3077-
character: CHARACTER opt_varying opt_charset
3077+
character: CHARACTER opt_varying
30783078
{
3079-
$$ = cat_str(3, make_str("character"), $2, $3);
3079+
$$ = cat2_str(make_str("character"), $2);
30803080
}
30813081
| CHAR opt_varying { $$ = cat2_str(make_str("char"), $2); }
30823082
| VARCHAR { $$ = make_str("varchar"); }
@@ -3101,10 +3101,18 @@ ConstDatetime: datetime
31013101
{
31023102
$$ = $1;
31033103
}
3104+
| TIMESTAMP '(' PosIntConst ')' opt_timezone
3105+
{
3106+
$$ = cat_str(4, make_str("timestamp("), $3, make_str(")"), $5);
3107+
}
31043108
| TIMESTAMP opt_timezone
31053109
{
31063110
$$ = cat2_str(make_str("timestamp"), $2);
31073111
}
3112+
| TIME '(' PosIntConst ')' opt_timezone
3113+
{
3114+
$$ = cat_str(4, make_str("time("), $3, make_str(")"), $5);
3115+
}
31083116
| TIME opt_timezone
31093117
{
31103118
$$ = cat2_str(make_str("time"), $2);
@@ -3439,36 +3447,24 @@ c_expr: attr
34393447
{ $$ = cat2_str($1, make_str("(*)")); }
34403448
| CURRENT_DATE
34413449
{ $$ = make_str("current_date"); }
3442-
| CURRENT_TIME
3443-
{ $$ = make_str("current_time"); }
3450+
| CURRENT_TIME opt_empty_parentheses
3451+
{ $$ = cat2_str(make_str("current_time"), $2); }
34443452
| CURRENT_TIME '(' PosIntConst ')'
34453453
{
3446-
if (atol($3) != 0)
3447-
{
3448-
sprintf(errortext, "CURRENT_TIME(%s) precision not implemented; backend will use zero instead", $3);
3449-
mmerror(ET_NOTICE, errortext);
3450-
}
3451-
34523454
$$ = make_str("current_time");
34533455
}
3454-
| CURRENT_TIMESTAMP
3455-
{ $$ = make_str("current_timestamp"); }
3456+
| CURRENT_TIMESTAMP opt_empty_parentheses
3457+
{ $$ = cat2_str(make_str("current_timestamp"), $2); }
34563458
| CURRENT_TIMESTAMP '(' PosIntConst ')'
34573459
{
3458-
if (atol($3) != 0)
3459-
{
3460-
sprintf(errortext, "CURRENT_TIMESTAMP(%s) precision not implemented; backend will use zero instead", $3);
3461-
mmerror(ET_NOTICE, errortext);
3462-
}
3463-
34643460
$$ = make_str("current_timestamp");
34653461
}
3466-
| CURRENT_USER
3467-
{ $$ = make_str("current_user"); }
3468-
| SESSION_USER
3469-
{ $$ = make_str("session_user"); }
3470-
| USER
3471-
{ $$ = make_str("user"); }
3462+
| CURRENT_USER opt_empty_parentheses
3463+
{ $$ = cat2_str(make_str("current_user"), $2); }
3464+
| SESSION_USER opt_empty_parentheses
3465+
{ $$ = cat2_str(make_str("session_user"), $2); }
3466+
| USER opt_empty_parentheses
3467+
{ $$ = cat2_str(make_str("user"), $2); }
34723468
| EXTRACT '(' extract_list ')'
34733469
{ $$ = cat_str(3, make_str("extract("), $3, make_str(")")); }
34743470
| POSITION '(' position_list ')'
@@ -3528,8 +3524,6 @@ extract_list: extract_arg FROM a_expr
35283524
extract_arg: datetime { $$ = $1; }
35293525
| SCONST { $$ = $1; }
35303526
| IDENT { $$ = $1; }
3531-
| TIMEZONE_HOUR { $$ = make_str("timezone_hour"); }
3532-
| TIMEZONE_MINUTE { $$ = make_str("timezone_minute"); }
35333527
;
35343528

35353529
/* position_list uses b_expr not a_expr to avoid conflict with general IN */
@@ -3663,6 +3657,8 @@ attrs: attr_name
36633657
{ $$ = make2_str($1, make_str(".*")); }
36643658
;
36653659

3660+
opt_empty_parentheses: '(' ')' { $$ = make_str("()"); }
3661+
| /*EMPTY*/ { $$ = EMPTY; }
36663662

36673663
/*****************************************************************************
36683664
*
@@ -5063,8 +5059,6 @@ TokenId: ABSOLUTE { $$ = make_str("absolute"); }
50635059
| TEMP { $$ = make_str("temp"); }
50645060
| TEMPLATE { $$ = make_str("template"); }
50655061
| TEMPORARY { $$ = make_str("temporary"); }
5066-
| TIMEZONE_HOUR { $$ = make_str("timezone_hour"); }
5067-
| TIMEZONE_MINUTE { $$ = make_str("timezone_minute"); }
50685062
| TOAST { $$ = make_str("toast"); }
50695063
| TRIGGER { $$ = make_str("trigger"); }
50705064
| TRUNCATE { $$ = make_str("truncate"); }
@@ -5092,8 +5086,6 @@ ECPGColId: ident { $$ = $1; }
50925086
| NATIONAL { $$ = make_str("national"); }
50935087
| NONE { $$ = make_str("none"); }
50945088
| PATH_P { $$ = make_str("path_p"); }
5095-
| TIME { $$ = make_str("time"); }
5096-
| TIMESTAMP { $$ = make_str("timestamp"); }
50975089
| ECPGKeywords { $$ = $1; }
50985090
;
50995091

@@ -5195,6 +5187,8 @@ ECPGColLabel: ECPGColId { $$ = $1; }
51955187
| SUBSTRING { $$ = make_str("substring"); }
51965188
| TABLE { $$ = make_str("table"); }
51975189
| THEN { $$ = make_str("then"); }
5190+
| TIME { $$ = make_str("time"); }
5191+
| TIMESTAMP { $$ = make_str("timestamp"); }
51985192
| TO { $$ = make_str("to"); }
51995193
| TRANSACTION { $$ = make_str("transaction"); }
52005194
| TRIM { $$ = make_str("trim"); }

0 commit comments

Comments
 (0)