1
- /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.357 2007/12/28 11:25:21 meskes Exp $ */
1
+ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.358 2008/01/14 09:43:42 meskes Exp $ */
2
2
3
3
/* Copyright comment */
4
4
%{
@@ -1288,7 +1288,10 @@ VariableShowStmt: SHOW var_name ecpg_into
1288
1288
| SHOW SESSION AUTHORIZATION ecpg_into
1289
1289
{ $$ = make_str(" show session authorization" ); }
1290
1290
| SHOW ALL
1291
- { mmerror(PARSE_ERROR, ET_ERROR, " SHOW ALL not implemented" ); }
1291
+ {
1292
+ mmerror (PARSE_ERROR, ET_ERROR, " SHOW ALL not implemented" );
1293
+ $$ = EMPTY;
1294
+ }
1292
1295
;
1293
1296
1294
1297
VariableResetStmt : RESET var_name
@@ -2300,22 +2303,22 @@ FetchStmt: FETCH fetch_direction from_in name ecpg_into
2300
2303
}
2301
2304
| FETCH from_in name ecpg_into
2302
2305
{
2303
- add_additional_variables ($3 , false );
2306
+ add_additional_variables ($3 , false );
2304
2307
$$ = cat_str(3 , make_str(" fetch" ), $2 , $3 );
2305
2308
}
2306
2309
| FETCH name ecpg_into
2307
2310
{
2308
- add_additional_variables ($2 , false );
2311
+ add_additional_variables ($2 , false );
2309
2312
$$ = cat2_str(make_str(" fetch" ), $2 );
2310
2313
}
2311
2314
| FETCH fetch_direction from_in name
2312
2315
{
2313
- add_additional_variables ($4 , false );
2316
+ add_additional_variables ($4 , false );
2314
2317
$$ = cat_str(4 , make_str(" fetch" ), $2 , $3 , $4 );
2315
2318
}
2316
2319
| FETCH fetch_direction name
2317
2320
{
2318
- add_additional_variables ($3 , false );
2321
+ add_additional_variables ($3 , false );
2319
2322
$$ = cat_str(4 , make_str(" fetch" ), $2 , make_str(" from" ), $3 );
2320
2323
}
2321
2324
| FETCH from_in name
@@ -2325,7 +2328,7 @@ FetchStmt: FETCH fetch_direction from_in name ecpg_into
2325
2328
}
2326
2329
| FETCH name
2327
2330
{
2328
- add_additional_variables ($2 , false );
2331
+ add_additional_variables ($2 , false );
2329
2332
$$ = cat2_str(make_str(" fetch" ), $2 );
2330
2333
}
2331
2334
| MOVE fetch_direction from_in name
@@ -2340,42 +2343,57 @@ fetch_direction: NEXT { $$ = make_str("next"); }
2340
2343
| LAST_P { $$ = make_str(" last" ); }
2341
2344
| ABSOLUTE_P IntConst {
2342
2345
if ($2 [1 ] == ' $' )
2343
- mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variable.\n " );
2346
+ {
2347
+ mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variable, ignoring it.\n " );
2348
+ $$ = make_str(" absolute" );
2349
+ }
2344
2350
else
2345
2351
$$ = cat2_str(make_str(" absolute" ), $2 );
2346
2352
}
2347
2353
| RELATIVE_P IntConst {
2348
2354
if ($2 [1 ] == ' $' )
2349
- mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variable.\n " );
2355
+ {
2356
+ mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variable, ignoring it.\n " );
2357
+ $$ = make_str(" relative" );
2358
+ }
2350
2359
else
2351
2360
$$ = cat2_str(make_str(" relative" ), $2 );
2352
2361
}
2353
2362
| IntConst {
2354
2363
if ($1 [1 ] == ' $' )
2355
- mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variable.\n " );
2364
+ {
2365
+ mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variablei, ignoring it.\n " );
2366
+ $$ = EMPTY;
2367
+ }
2356
2368
else
2357
2369
$$ = $1 ;
2358
2370
}
2359
2371
| ALL { $$ = make_str(" all" ); }
2360
2372
| FORWARD { $$ = make_str(" forward" ); }
2361
2373
| FORWARD IntConst {
2362
2374
if ($2 [1 ] == ' $' )
2363
- mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variable.\n " );
2375
+ {
2376
+ mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variable, ignoring it.\n " );
2377
+ $$ = make_str(" forward" );
2378
+ }
2364
2379
else
2365
2380
$$ = cat2_str(make_str(" forward" ), $2 );
2366
2381
}
2367
2382
| FORWARD ALL { $$ = make_str(" forward all" ); }
2368
2383
| BACKWARD { $$ = make_str(" backward" ); }
2369
2384
| BACKWARD IntConst {
2370
2385
if ($2 [1 ] == ' $' )
2371
- mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variable.\n " );
2386
+ {
2387
+ mmerror (PARSE_ERROR, ET_ERROR, " fetch/move count must not be a variable, ignoring it.\n " );
2388
+ $$ = make_str(" backward" );
2389
+ }
2372
2390
else
2373
2391
$$ = cat2_str(make_str(" backward" ), $2 );
2374
2392
}
2375
2393
| BACKWARD ALL { $$ = make_str(" backward all" ); }
2376
2394
;
2377
2395
2378
- from_in : IN_P { $$ = make_str(" in" ); }
2396
+ from_in : IN_P { $$ = make_str(" in" ); }
2379
2397
| FROM { $$ = make_str(" from" ); }
2380
2398
;
2381
2399
@@ -2744,7 +2762,10 @@ RemoveOperStmt: DROP OPERATOR all_Op '(' oper_argtypes ')' opt_drop_behavior
2744
2762
;
2745
2763
2746
2764
oper_argtypes : Typename
2747
- { mmerror(PARSE_ERROR, ET_ERROR, " parser: argument type missing (use NONE for unary operators)" ); }
2765
+ {
2766
+ mmerror (PARSE_ERROR, ET_ERROR, " parser: argument type missing (use NONE for unary operators)" );
2767
+ $$ = make_str(" none" );
2768
+ }
2748
2769
| Typename ' ,' Typename
2749
2770
{ $$ = cat_str(3 , $1 , make_str(" ," ), $3 ); }
2750
2771
| NONE ' ,' Typename /* left unary */
@@ -3665,7 +3686,10 @@ select_limit: LIMIT select_limit_value OFFSET select_offset_value
3665
3686
| OFFSET select_offset_value
3666
3687
{ $$ = cat2_str(make_str(" offset" ), $2 ); }
3667
3688
| LIMIT select_limit_value ' ,' select_offset_value
3668
- { mmerror(PARSE_ERROR, ET_WARNING, " No longer supported LIMIT #,# syntax passed to backend." ); }
3689
+ {
3690
+ mmerror (PARSE_ERROR, ET_WARNING, " No longer supported LIMIT #,# syntax passed to backend." );
3691
+ $$ = cat_str(4 , make_str(" limit" ), $2 , make_str(" ," ), $4 );
3692
+ }
3669
3693
;
3670
3694
3671
3695
opt_select_limit : select_limit { $$ = $1 ; }
@@ -3757,25 +3781,28 @@ from_list: from_list ',' table_ref { $$ = cat_str(3, $1, make_str(","), $3); }
3757
3781
table_ref : relation_expr
3758
3782
{ $$ = $1 ; }
3759
3783
| relation_expr alias_clause
3760
- { $$ = cat2_str($1 , $2 ); }
3784
+ { $$ = cat2_str($1 , $2 ); }
3761
3785
| func_table
3762
3786
{ $$ = $1 ; }
3763
3787
| func_table alias_clause
3764
- { $$ = cat2_str($1 , $2 ); }
3788
+ { $$ = cat2_str($1 , $2 ); }
3765
3789
| func_table AS ' (' TableFuncElementList ' )'
3766
- { $$ = cat_str(4 , $1 , make_str(" as (" ), $4 , make_str(" )" )); }
3790
+ { $$ = cat_str(4 , $1 , make_str(" as (" ), $4 , make_str(" )" )); }
3767
3791
| func_table AS ColId ' (' TableFuncElementList ' )'
3768
- { $$ = cat_str(6 , $1 , make_str(" as" ), $3 , make_str(" (" ), $5 , make_str(" )" ));}
3792
+ { $$ = cat_str(6 , $1 , make_str(" as" ), $3 , make_str(" (" ), $5 , make_str(" )" ));}
3769
3793
| func_table ColId ' (' TableFuncElementList ' )'
3770
- { $$ = cat_str(5 , $1 , $2 , make_str(" (" ), $4 , make_str(" )" )); }
3794
+ { $$ = cat_str(5 , $1 , $2 , make_str(" (" ), $4 , make_str(" )" )); }
3771
3795
| select_with_parens
3772
- {mmerror(PARSE_ERROR, ET_ERROR, " sub-SELECT in FROM must have an alias" );}
3796
+ {
3797
+ mmerror (PARSE_ERROR, ET_ERROR, " sub-SELECT in FROM must have an alias" );
3798
+ $$ = $1 ;
3799
+ }
3773
3800
| select_with_parens alias_clause
3774
- { $$ = cat2_str($1 , $2 ); }
3801
+ { $$ = cat2_str($1 , $2 ); }
3775
3802
| joined_table
3776
3803
{ $$ = $1 ; }
3777
3804
| ' (' joined_table ' )' alias_clause
3778
- { $$ = cat_str(4 , make_str(" (" ), $2 , make_str(" )" ), $4 ); }
3805
+ { $$ = cat_str(4 , make_str(" (" ), $2 , make_str(" )" ), $4 ); }
3779
3806
;
3780
3807
3781
3808
/*
@@ -5159,6 +5186,7 @@ char_variable: cvariable
5159
5186
break ;
5160
5187
default :
5161
5188
mmerror (PARSE_ERROR, ET_ERROR, " invalid datatype" );
5189
+ $$ = $1 ;
5162
5190
break ;
5163
5191
}
5164
5192
}
0 commit comments