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

Commit 51aacec

Browse files
author
Michael Meskes
committed
Synced parser
1 parent 00306ef commit 51aacec

File tree

2 files changed

+38
-36
lines changed

2 files changed

+38
-36
lines changed

src/interfaces/ecpg/ChangeLog

+4
Original file line numberDiff line numberDiff line change
@@ -1869,6 +1869,10 @@ Tue Oct 5 12:45:48 CEST 2004
18691869

18701870
- '::' is no longer interpreted as a variable in a prepare statement.
18711871
Added patch by Daniel Verite to fix this.
1872+
1873+
Mon Oct 18 15:34:51 CEST 2004
1874+
1875+
- Synced parser.
18721876
- Set ecpg version to 3.2.0.
18731877
- Set compat library version to 1.2.
18741878
- Set ecpg library version to 4.2.

src/interfaces/ecpg/preproc/preproc.y

+34-36
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.297 2004/09/27 09:59:17 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.298 2004/10/18 13:36:23 meskes Exp $ */
22

33
/* Copyright comment */
44
%{
@@ -545,7 +545,7 @@ add_additional_variables(char *name, bool insert)
545545
%type <str> storage_declaration storage_clause opt_initializer c_anything
546546
%type <str> variable_list variable c_thing c_term ECPGKeywords_vanames
547547
%type <str> opt_pointer ECPGDisconnect dis_name storage_modifier
548-
%type <str> execstring server_name ECPGVarDeclaration
548+
%type <str> execstring server_name ECPGVarDeclaration func_expr
549549
%type <str> connection_object opt_server opt_port c_stuff c_stuff_item
550550
%type <str> user_name opt_user char_variable ora_user ident opt_reference
551551
%type <str> var_type_declarations quoted_ident_stringvar ECPGKeywords_rest
@@ -2210,8 +2210,8 @@ index_params: index_elem { $$ = $1; }
22102210

22112211
index_elem: ColId opt_class
22122212
{ $$ = cat2_str($1, $2); }
2213-
| func_name '(' expr_list ')' opt_class
2214-
{ $$ = cat_str(5, $1, make_str("("), $3, ")", $5); }
2213+
| func_expr opt_class
2214+
{ $$ = cat2_str($1, $2); }
22152215
| '(' a_expr ')' opt_class
22162216
{ $$ = cat_str(4, make_str("("), $2, make_str(")"), $4); }
22172217
;
@@ -3291,10 +3291,7 @@ relation_expr: qualified_name
32913291
{ /* inheritance query */ $$ = cat_str(3, make_str("only ("), $3, make_str(")")); }
32923292
;
32933293

3294-
func_table: func_name '(' ')'
3295-
{ $$ = cat2_str($1, make_str("()")); }
3296-
| func_name '(' expr_list ')'
3297-
{ $$ = cat_str(4, $1, make_str("("), $3, make_str(")")); }
3294+
func_table: func_expr { $$ = $1; }
32983295
;
32993296

33003297
where_clause: WHERE a_expr { $$ = cat2_str(make_str("where"), $2); }
@@ -3769,7 +3766,29 @@ c_expr: columnref
37693766
{ $$ = cat_str(4, make_str("("), $2, make_str(")"), $4); }
37703767
| case_expr
37713768
{ $$ = $1; }
3772-
| func_name '(' ')'
3769+
| func_expr
3770+
{ $$ = $1; }
3771+
| select_with_parens %prec UMINUS
3772+
{ $$ = $1; }
3773+
| EXISTS select_with_parens
3774+
{ $$ = cat2_str(make_str("exists"), $2); }
3775+
| ARRAY select_with_parens
3776+
{ $$ = cat2_str(make_str("array"), $2); }
3777+
| ARRAY array_expr
3778+
{ $$ = cat2_str(make_str("array"), $2); }
3779+
| row
3780+
{ $$ = $1; }
3781+
;
3782+
3783+
/*
3784+
* func_expr is split out from c_expr just so that we have a classification
3785+
* for "everything that is a function call or looks like one". This isn't
3786+
* very important, but it saves us having to document which variants are
3787+
* legal in the backwards-compatible functional-index syntax for CREATE INDEX.
3788+
* (Note that many of the special SQL functions wouldn't actually make any
3789+
* sense as functional index entries, but we ignore that consideration here.)
3790+
*/
3791+
func_expr: func_name '(' ')'
37733792
{ $$ = cat2_str($1, make_str("()")); }
37743793
| func_name '(' expr_list ')'
37753794
{ $$ = cat_str(4, $1, make_str("("), $3, make_str(")")); }
@@ -3820,18 +3839,13 @@ c_expr: columnref
38203839
{ $$ = cat_str(5, make_str("convert("), $3, make_str("using"), $5, make_str(")"));}
38213840
| CONVERT '(' expr_list ')'
38223841
{ $$ = cat_str(3, make_str("convert("), $3, make_str(")")); }
3823-
| select_with_parens %prec UMINUS
3824-
{ $$ = $1; }
3825-
| EXISTS select_with_parens
3826-
{ $$ = cat2_str(make_str("exists"), $2); }
3827-
| ARRAY select_with_parens
3828-
{ $$ = cat2_str(make_str("array"), $2); }
3829-
| ARRAY array_expr
3830-
{ $$ = cat2_str(make_str("array"), $2); }
3831-
| row
3832-
{ $$ = $1; }
3842+
| NULLIF '(' a_expr ',' a_expr ')'
3843+
{ $$ = cat_str(5, make_str("nullif("), $3, make_str(","), $5, make_str(")")); }
3844+
| COALESCE '(' expr_list ')'
3845+
{ $$ = cat_str(3, make_str("coalesce("), $3, make_str(")")); }
38333846
;
38343847

3848+
38353849
row: ROW '(' expr_list ')'
38363850
{ $$ = cat_str(3, make_str("row ("), $3, make_str(")")); }
38373851
| ROW '(' ')'
@@ -3972,25 +3986,9 @@ in_expr: select_with_parens
39723986

39733987
/* Case clause
39743988
* Define SQL92-style case clause.
3975-
* Allow all four forms described in the standard:
3976-
* - Full specification
3977-
* CASE WHEN a = b THEN c ... ELSE d END
3978-
* - Implicit argument
3979-
* CASE a WHEN b THEN c ... ELSE d END
3980-
* - Conditional NULL
3981-
* NULLIF(x,y)
3982-
* same as CASE WHEN x = y THEN NULL ELSE x END
3983-
* - Conditional substitution from list, use first non-null argument
3984-
* COALESCE(a,b,...)
3985-
* same as CASE WHEN a IS NOT NULL THEN a WHEN b IS NOT NULL THEN b ... END
3986-
* - thomas 1998-11-09
39873989
*/
39883990
case_expr: CASE case_arg when_clause_list case_default END_P
39893991
{ $$ = cat_str(5, make_str("case"), $2, $3, $4, make_str("end")); }
3990-
| NULLIF '(' a_expr ',' a_expr ')'
3991-
{ $$ = cat_str(5, make_str("nullif("), $3, make_str(","), $5, make_str(")")); }
3992-
| COALESCE '(' expr_list ')'
3993-
{ $$ = cat_str(3, make_str("coalesce("), $3, make_str(")")); }
39943992
;
39953993

39963994
when_clause_list: when_clause_list when_clause
@@ -5981,6 +5979,7 @@ ECPGunreserved: ABORT_P { $$ = make_str("abort"); }
59815979
| NOCREATEUSER { $$ = make_str("nocreateuser"); }
59825980
| NOTHING { $$ = make_str("nothing"); }
59835981
| NOTIFY { $$ = make_str("notify"); }
5982+
| NOWAIT { $$ = make_str("nowait"); }
59845983
| OBJECT_P { $$ = make_str("object"); }
59855984
| OF { $$ = make_str("of"); }
59865985
| OIDS { $$ = make_str("oids"); }
@@ -6196,7 +6195,6 @@ reserved_keyword:
61966195
| LIMIT { $$ = make_str("limit"); }
61976196
| NEW { $$ = make_str("new"); }
61986197
| NOT { $$ = make_str("not"); }
6199-
| NOWAIT { $$ = make_str("nowait"); }
62006198
| NULL_P { $$ = make_str("null"); }
62016199
| OFF { $$ = make_str("off"); }
62026200
| OFFSET { $$ = make_str("offset"); }

0 commit comments

Comments
 (0)