8000 Synced parser. · dirbacke/postgres@3223374 · GitHub
[go: up one dir, main page]

Skip to content
Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3223374

Browse files
author
Michael Meskes
committed
Synced parser.
1 parent aa7fdbe commit 3223374

File tree

3 files changed

+96
-34
lines changed

3 files changed

+96
-34
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,12 @@ Sun Aug 18 16:09:06 CEST 2002
12861286

12871287
Tue Aug 20 14:13:34 CEST 2002
12881288

1289-
- Removed ',' from preproc.y to bit bison 1.49b.
1289+
- Removed ',' from preproc.y for bison 1.49b.
1290+
1291+
Sun Sep 1 11:13:04 CEST 2002
1292+
1293+
- Synced preproc.y with gram.y.
1294+
- Synced keywords.c.
12901295
- Set ecpg version to 2.10.0.
12911296
- Set library version to 3.4.0.
12921297

src/interfaces/ecpg/preproc/keywords.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.50.2.3 2002/08/18 14:32:21 meskes Exp $
11+
* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.50.2.4 2002/09/01 09:31:58 meskes Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -94,6 +94,7 @@ static ScanKeyword ScanKeywords[] = {
9494
{"cycle", CYCLE},
9595
{"database", DATABASE},
9696
{"day", DAY_P},
97+
{"deallocate", DEALLOCATE},
9798
{"dec", DEC},
9899
{"decimal", DECIMAL},
99100
{"declare", DECLARE},
@@ -223,6 +224,7 @@ static ScanKeyword ScanKeywords[] = {
223224
{"pendant", PENDANT},
224225
{"position", POSITION},
225226
{"precision", PRECISION},
227+
{"prepare", PREPARE},
226228
{"primary", PRIMARY},
227229
{"prior", PRIOR},
228230
{"privileges", PRIVILEGES},

src/interfaces/ecpg/preproc/preproc.y

Lines changed: 87 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.190.2.4 2002/08/20 12:23:36 meskes Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.190.2.5 2002/09/01 09:31:58 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -191,8 +191,9 @@ make_name(void)
191191
CREATE CREATEDB CREATEUSER CROSS CURRENT_DATE CURRENT_TIME
192192
CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
193193

194-
DATABASE DAY_P DEC DECIMAL DECLARE DEFAULT DEFERRABLE DEFERRED
195-
DEFINER DELETE_P DELIMITER DELIMITERS DESC DISTINCT DO DOMAIN_P DOUBLE DROP
194+
DATABASE DAY_P DEALLOCATE DEC DECIMAL DECLARE DEFAULT
195+
DEFERRABLE DEFERRED DEFINER DELETE_P DELIMITER DELIMITERS
196+
DESC DISTINCT DO DOMAIN_P DOUBLE DROP
196197
EACH ELSE ENCODING ENCRYPTED END_TRANS ESCAPE EXCEPT EXCLUSIVE
197198
EXECUTE EXISTS EXPLAIN EXTERNAL EXTRACT
198199

@@ -221,8 +222,8 @@ make_name(void)
221222
OF OFF OFFSET OIDS OLD ON ONLY OPERATOR OPTION OR ORDER
222223
OUT_P OUTER_P OVERLAPS OVERLAY OWNER
223224

224-
PARTIAL PASSWORD PATH_P PENDANT PLACING POSITION PRECISION PRIMARY
225-
PRIOR PRIVILEGES PROCEDURE PROCEDURAL
225+
PARTIAL PASSWORD PATH_P PENDANT PLACING POSITION PRECISION PREPARE
226+
PRIMARY PRIOR PRIVILEGES PROCEDURE PROCEDURAL
226227

227228
READ REAL RECHECK REFERENCES REINDEX RELATIVE RENAME REPLACE
228229
RESET RESTRICT RETURNS REVOKE RIGHT ROLLBACK ROW RULE
@@ -287,9 +288,9 @@ make_name(void)
287288
%type <str> CreateAsElement OptCreateAs CreateAsList CreateAsStmt
288289
%type <str> comment_text ConstraintDeferrabilitySpec TableElementList
289290
%type <str> key_match ColLabel SpecialRuleRelation ColId columnDef
290-
%type <str> ColConstraint ColConstraintElem drop_type Bconst
291-
%type <str> TableConstraint OptTableElementList Xconst
292-
%type <str> ConstraintElem key_actions ColQualList type_name
291+
%type <str> ColConstraint ColConstraintElem drop_type Bconst
292+
%type <str> TableConstraint OptTableElementList Xconst prep_type_clause
293+
%type <str> ConstraintElem key_actions ColQualList type_name PrepareStmt
293294
%type <str> target_list target_el update_target_list alias_clause
294295
%type <str> update_target_el opt_id qualified_name database_name
295296
%type <str> access_method attr_name index_name name func_name
@@ -300,7 +301,7 @@ make_name(void)
300301
%type <str> trim_list in_expr substr_for attrs TableFuncElement
301302
%type <str> Typename SimpleTypename Numeric opt_float opt_numeric
302303
%type <str> opt_decimal Character character opt_varying opt_charset
303-
%type <str> opt_collate opt_timezone opt_interval table_ref
304+
%type <str> opt_collate opt_timezone opt_interval table_ref DeallocateStmt
304305
%type <str> row_descriptor row_list ConstDatetime trans_options
305306
%type <str> SelectStmt into_clause OptTemp ConstraintAttributeSpec
306307
%type <str> opt_table opt_all sort_clause sortby_list ConstraintAttr
@@ -321,7 +322,7 @@ make_name(void)
321322
%type <str> def_elem def_list definition DefineStmt select_with_parens
322323
%type <str> opt_instead event RuleActionList opt_using CreateAssertStmt
323324
%type <str> RuleActionStmtOrEmpty RuleActionMulti func_as reindex_type
324-
%type <str> RuleStmt opt_column opt_name oper_argtypes NumConst
325+
%type <str> RuleStmt opt_column opt_name oper_argtypes NumConst ExecuteStmt
325326
%type <str> MathOp RemoveFuncStmt aggr_argtype for_update_clause
326327
%type <str> RemoveAggrStmt opt_procedural select_no_parens CreateCastStmt
327328
%type <str> RemoveOperStmt RenameStmt all_Op opt_Trusted opt_lancompiler
@@ -363,10 +364,11 @@ make_name(void)
363364
%type <str> opt_oids TableLikeClause key_action opt_definition
364365
%type <str> opt_assignment row r_expr qual_Op qual_all_Op opt_default
365366
%type <str> CreateConversionStmt any_operator opclass_item_list
366-
%type <str> iso_level OptTableFuncElementList convert_list
367+
%type <str> iso_level convert_list prep_type_list
367368
%type <str> convert_args type_list CharacterWithLength ConstCharacter
368369
%type <str> CharacterWithoutLength BitWithLength BitWithoutLength
369-
%type <str> ConstBit GenericType TableFuncElementList
370+
%type <str> ConstBit GenericType TableFuncElementList execute_param_clause
371+
%type <str> execute_param_list opt_sort_clause
370372

371373
%type <str> ECPGWhenever ECPGConnect connection_target ECPGOpen
372374
%type <str> indicator ECPGExecute ECPGPrepare ecpg_using ecpg_into
@@ -454,6 +456,7 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
454456
| CreateTrigStmt { output_statement($1, 0, connection); }
455457
| CreateUserStmt { output_statement($1, 0, connection); }
456458
| ClusterStmt { output_statement($1, 0, connection); }
459+
| DeallocateStmt { output_statement($1, 0, connection); }
457460
| DefineStmt { output_statement($1, 0, connection); }
458461
| DropStmt { output_statement($1, 0, connection); }
459462
| TruncateStmt { output_statement($1, 0, connection); }
@@ -466,13 +469,15 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); }
466469
| DropRuleStmt { output_statement($1, 0, connection); }
467470
| DropUserStmt { output_statement($1, 0, connection); }
468471
| ExplainStmt { output_statement($1, 0, connection); }
472+
| ExecuteStmt { output_statement($1, 0, connection); }
469473
| FetchStmt { output_statement($1, 1, connection); }
470474
| GrantStmt { output_statement($1, 0, connection); }
471475
| IndexStmt { output_statement($1, 0, connection); }
472476
| ListenStmt { output_statement($1, 0, connection); }
473477
| UnlistenStmt { output_statement($1, 0, connection); }
474478
| LockStmt { output_statement($1, 0, connection); }
475479
| NotifyStmt { output_statement($1, 0, connection); }
480+
| PrepareStmt { output_statement($1, 0, connection); }
476481
| ReindexStmt { output_statement($1, 0, connection); }
477482
| RemoveAggrStmt { output_statement($1, 0, connection); }
478483
| RemoveOperStmt { output_statement($1, 0, connection); }
@@ -1122,10 +1127,10 @@ OptTableElementList: TableElementList
11221127
| /*EMPTY*/
11231128
{ $$ = EMPTY; }
11241129
;
1125-
TableElementList: TableElementList ',' TableElement
1126-
{ $$ = cat_str(3, $1, make_str(","), $3); }
1127-
| TableElement
1130+
TableElementList: TableElement
11281131
{ $$ = $1; }
1132+
| TableElementList ',' TableElement
1133+
{ $$ = cat_str(3, $1, make_str(","), $3); }
11291134
;
11301135

11311136
TableElement: columnDef { $$ = $1; }
@@ -2358,6 +2363,54 @@ ExplainStmt: EXPLAIN opt_verbose OptimizableStmt
23582363
{ $$ = cat_str(4, make_str("explain"), $2, $3, $4); }
23592364
;
23602365

2366+
/*****************************************************************************
2367+
*
2368+
* QUERY:
2369+
* PREPARE <plan_name> [(args, ...)] AS <query>
2370+
*
2371+
*****************************************************************************/
2372+
2373+
PrepareStmt: PREPARE name prep_type_clause AS OptimizableStmt
2374+
{ $$ = cat_str(5, make_str("prepare"), $2, $3, make_str("as"), $5); }
2375+
;
2376+
2377+
prep_type_clause: '(' prep_type_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
2378+
| /* EMPTY */ { $$ = EMPTY; }
2379+
;
2380+
2381+
prep_type_list: Typename { $$ = $1; }
2382+
| prep_type_list ',' Typename { $$ = cat_str(3, $1, make_str(","), $3); }
2383+
;
2384+
2385+
/*****************************************************************************
2386+
*
2387+
* QUERY:
2388+
* EXECUTE <plan_name> [(params, ...)] [INTO ...]
2389+
*
2390+
*****************************************************************************/
2391+
2392+
ExecuteStmt: EXECUTE name execute_param_clause into_clause
2393+
{ $$ = cat_str(4, make_str("execute"), $2, $3, $4); }
2394+
;
2395+
2396+
execute_param_clause: '(' execute_param_list ')' { $$ = cat_str(3, make_str("("), $2, make_str(")")); }
2397+
| /* EMPTY */ { $$ = EMPTY; }
2398+
;
2399+
2400+
execute_param_list: a_expr { $$ = $1; }
2401+
| execute_param_list ',' a_expr { $$ = cat_str(3, $1, make_str(","), $3); }
2402+
;
2403+
2404+
/*****************************************************************************
2405+
*
2406+
* QUERY:
2407+
* DEALLOCATE [PREPARE] <plan_name>
2408+
*
2409+
*****************************************************************************/
2410+
2411+
DeallocateStmt: DEALLOCATE name { $$ = cat2_str(make_str("deallocate"), $2); }
2412+
| DEALLOCATE PREPARE name { $$ = cat2_str(make_str("deallocate prepare"), $3); }
2413+
;
23612414

23622415
/*****************************************************************************
23632416
* *
@@ -2523,12 +2576,12 @@ select_with_parens: '(' select_no_parens ')'
25232576

25242577
select_no_parens: simple_select
25252578
{ $$ = $1; }
2526-
| select_clause sort_clause opt_for_update_clause opt_select_limit
2527-
{ $$ = cat_str(4, $1, $2, $3, $4); }
2528-
| select_clause for_update_clause opt_select_limit
2529-
{ $$ = cat_str(3, $1, $2, $3); }
2530-
| select_clause select_limit
2579+
| select_clause sort_clause
25312580
{ $$ = cat2_str($1, $2); }
2581+
| select_clause opt_sort_clause for_update_clause opt_select_limit
2582+
{ $$ = cat_str(4, $1, $2, $3, $4); }
2583+
| select_clause opt_sort_clause select_limit opt_for_update_clause
2584+
{ $$ = cat_str(4, $1, $2, $3, $4); }
25322585
;
25332586

25342587
select_clause: simple_select { $$ = $1; }
@@ -2605,6 +2658,10 @@ opt_distinct: DISTINCT
26052658
{ $$ = EMPTY; }
26062659
;
26072660

2661+
opt_sort_clause: sort_clause { $$ = $1; }
2662+
| /* EMPTY */ { $$ = EMPTY; }
2663+
;
2664+
26082665
sort_clause: ORDER BY sortby_list
26092666
{ $$ = cat2_str(make_str("order by"), $3); }
26102667
;
@@ -2720,14 +2777,14 @@ table_ref: relation_expr
27202777
{ $$= cat2_str($1, $2); }
27212778
| func_table
27222779
{ $$ = $1; }
2723-
| func_table AS '(' OptTableFuncElementList ')'
2780+
| func_table alias_clause
2781+
{ $$= cat2_str($1, $2); }
2782+
| func_table AS '(' TableFuncElementList ')'
27242783
{ $$=cat_str(4, $1, make_str("as ("), $4, make_str(")")); }
2725-
| func_table AS ColId '(' OptTableFuncElementList ')'
2784+
| func_table AS ColId '(' TableFuncElementList ')'
27262785
{ $$=cat_str(6, $1, make_str("as"), $3, make_str("("), $5, make_str(")")); }
2727-
| func_table ColId '(' OptTableFuncElementList ')'
2786+
| func_table ColId '(' TableFuncElementList ')'
27282787
{ $$=cat_str(5, $1, $2, make_str("("), $4, make_str(")")); }
2729-
| func_table alias_clause
2730-
{ $$= cat2_str($1, $2); }
27312788
| select_with_parens
27322789
{mmerror(PARSE_ERROR, ET_ERROR, "sub-SELECT in FROM must have an alias");}
27332790
| select_with_parens alias_clause
@@ -2825,14 +2882,10 @@ where_clause: WHERE a_expr { $$ = cat2_str(make_str("where"), $2); }
28252882
| /*EMPTY*/ { $$ = EMPTY; /* no qualifiers */ }
28262883
;
28272884

2828-
OptTableFuncElementList: TableFuncElementList { $$ = $1; }
2829-
| /* EMPTY */ { $$ = EMPTY; }
2830-
;
2831-
2832-
TableFuncElementList: TableFuncElementList ',' TableFuncElement
2885+
TableFuncElementList: TableFuncElement
2886+
{ $$ = $1; }
2887+
| TableFuncElementList ',' TableFuncElement
28332888
{ $$ = cat_str(3, $1, ',', $3); }
2834-
| TableFuncElement
2835-
{ $$ = $1; }
28362889
;
28372890

28382891
TableFuncElement: ColId Typename { $$ = cat2_str($1, $2); }
@@ -5102,6 +5155,7 @@ unreserved_keyword:
51025155
| CYCLE { $$ = make_str("cycle"); }
51035156
| DATABASE { $$ = make_str("database"); }
51045157
| DAY_P { $$ = make_str("day"); }
5158+
| DEALLOCATE { $$ = make_str("deallocate"); }
51055159
| DECLARE { $$ = make_str("declare"); }
51065160
| DEFERRED { $$ = make_str("deferred"); }
51075161
| DELETE_P { $$ = make_str("delete"); }
@@ -5169,6 +5223,7 @@ unreserved_keyword:
51695223
| PATH_P { $$ = make_str("path"); }
51705224
| PENDANT { $$ = make_str("pendant"); }
51715225
| PRECISION { $$ = make_str("precision"); }
5226+
| PREPARE { $$ = make_str("prepare"); }
51725227
| PRIOR { $$ = make_str("prior"); }
51735228
| PRIVILEGES { $$ = make_str("privileges"); }
51745229
| PROCEDURAL { $$ = make_str("procedural"); }

0 commit comments

Comments
 (0)
0