1
- /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.334 2006/08/29 12:24:51 meskes Exp $*/
1
+ /* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/preproc.y,v 1.335 2006/09/03 12:24:07 meskes Exp $*/
2
2
3
3
/* Copyright comment*/
4
4
%{
@@ -360,7 +360,7 @@ add_additional_variables(char *name, bool insert)
360
360
CACHE CALLED CASCADE CASCADED CASE CAST CHAIN CHAR_P
361
361
CHARACTER CHARACTERISTICS CHECK CHECKPOINT CLASS CLOSE
362
362
CLUSTER COALESCE COLLATE COLUMN COMMENT COMMIT
363
- COMMITTED CONNECTION CONSTRAINT CONSTRAINTS CONVERSION_P CONVERT COPY CREATE CREATEDB
363
+ COMMITTEDCONCURRENTLY CONNECTION CONSTRAINT CONSTRAINTS CONVERSION_P CONVERT COPY CREATE CREATEDB
364
364
CREATEROLE CREATEUSER CROSS CSV CURRENT_DATE CURRENT_ROLE CURRENT_TIME
365
365
CURRENT_TIMESTAMP CURRENT_USER CURSOR CYCLE
366
366
@@ -575,7 +575,7 @@ add_additional_variables(char *name, bool insert)
575
575
%type <str> reserved_keyword unreserved_keyword ecpg_interval opt_ecpg_using
576
576
%type <str> col_name_keyword func_name_keyword precision opt_scale
577
577
%type <str> ECPGTypeName using_list ECPGColLabelCommon UsingConst
578
- %type <str> inf_val_list inf_col_list using_descriptor into_descriptor
578
+ %type <str> using_descriptor into_descriptor
579
579
%type <str> prepared_name struct_union_type_with_symbol OptConsTableSpace
580
580
%type <str> ECPGunreserved ECPGunreserved_interval cvariable opt_bit_field
581
581
%type <str> AlterOwnerStmt OptTableSpaceOwner CreateTableSpaceStmt
@@ -587,6 +587,8 @@ add_additional_variables(char *name, bool insert)
587
587
%type <str> locked_rels_list opt_granted_by RevokeRoleStmt alterdb_opt_item using_clause
588
588
%type <str> GrantRoleStmt opt_asymmetric aggr_args aggr_args_list old_aggr_definition
589
589
%type <str> old_aggr_elem for_locking_items TableLikeOptionList TableLikeOption
590
+ %type <str> update_target_lists_list set_opt update_target_lists_el update_col_list
591
+ %type <str> update_value_list update_col_list_el
590
592
591
593
%type <struct_union> s_struct_union_symbol
592
594
@@ -1369,14 +1371,6 @@ ClosePortalStmt: CLOSE name
1369
1371
{$$ = cat2_str(make_str(" close" ),$2 );}
1370
1372
;
1371
1373
1372
- /* ****************************************************************************
1373
- *
1374
- *QUERY :
1375
- *COPY [BINARY] <relname> FROM/TO
1376
- *[USING DELIMITERS <delimiter>]
1377
- *
1378
- *****************************************************************************/
1379
-
1380
1374
CopyStmt :COPY opt_binary qualified_name opt_oids copy_from
1381
1375
copy_file_name copy_delimiter opt_with copy_opt_list
1382
1376
{
@@ -1389,6 +1383,13 @@ CopyStmt: COPY opt_binary qualified_name opt_oids copy_from
1389
1383
1390
1384
$$ = cat_str(9 , make_str(" copy" ),$2 ,$3 ,$4 ,$5 ,$6 ,$7 ,$8 ,$9 );
1391
1385
}
1386
+ | COPY select_with_parens TO copy_file_name opt_with copy_opt_list
1387
+ {
1388
+ if (strcmp($4 ," stdin" ) ==0 )
1389
+ mmerror (PARSE_ERROR, ET_ERROR," copy to stdin not possible.\n " );
1390
+
1391
+ $$ = cat_str(6 , make_str(" copy" ),$2 , make_str(" to" ),$4 ,$5 ,$6 );
1392
+ }
1392
1393
;
1393
1394
1394
1395
copy_from :TO {$$ = make_str(" to" ); }
@@ -2331,15 +2332,22 @@ opt_granted_by: GRANTED BY RoleId { $$ = cat2_str(make_str("granted by"), $3);
2331
2332
/* ****************************************************************************
2332
2333
*
2333
2334
*QUERY:
2334
- *create index <indexname> on <relname>
2335
- * [ using <access> ] "(" ( <col> | using <opclass> ] )+ ")"
2336
- * [ tablespace <tablespacename> ] [ where <predicate> ]
2335
+ * QUERY: CREATE INDEX
2336
+ *
2337
+ * Note: we can't factor CONCURRENTLY into a separate production without
2338
+ * making it a reserved word.
2339
+ *
2340
+ * Note: we cannot put TABLESPACE clause after WHERE clause unless we are
2341
+ * willing to make TABLESPACE a fully reserved word.
2337
2342
*
2338
2343
*****************************************************************************/
2339
2344
2340
2345
IndexStmt :CREATE index_opt_unique INDEX index_name ON qualified_name
2341
2346
access_method_clause ' (' index_params ' )' opt_definition OptTableSpace where_clause
2342
2347
{$$ = cat_str(13 , make_str(" create" ),$2 , make_str(" index" ),$4 , make_str(" on" ),$6 ,$7 , make_str(" (" ),$9 , make_str(" )" ),$11 ,$12 ,$13 ); }
2348
+ | CREATE index_opt_unique INDEX CONCURRENTLY index_name ON qualified_name
2349
+ access_method_clause ' (' index_params ' )' opt_definition OptTableSpace where_clause
2350
+ {$$ = cat_str(13 , make_str(" create" ),$2 , make_str(" index concurrently" ),$5 , make_str(" on" ),$7 ,$8 , make_str(" (" ),$10 , make_str(" )" ),$12 ,$13 ,$14 ); }
2343
2351
;
2344
2352
2345
2353
index_opt_unique :UNIQUE {$$ = make_str(" unique" ); }
@@ -3166,13 +3174,17 @@ opt_nowait: NOWAIT { $$ = make_str("nowait"); }
3166
3174
*****************************************************************************/
3167
3175
3168
3176
UpdateStmt :UPDATE relation_expr_opt_alias
3169
- SET update_target_list
3177
+ SET set_opt
3170
3178
from_clause
3171
3179
where_clause
3172
3180
returning_clause
3173
3181
{$$ = cat_str(7 , make_str(" update" ),$2 , make_str(" set" ),$4 ,$5 ,$6 ,$7 ); }
3174
3182
;
3175
3183
3184
+ set_opt :
3185
+ update_target_list {$$ =$1 ; }
3186
+ | update_target_lists_list {$$ =$1 ; }
3187
+ ;
3176
3188
3177
3189
/* ****************************************************************************
3178
3190
*
@@ -3433,6 +3445,35 @@ values_item:a_expr{ $$ = $1; }
3433
3445
| DEFAULT {$$ = make_str(" DEFAULT" ); }
3434
3446
;
3435
3447
3448
+ update_target_lists_list :
3449
+ update_target_lists_el {$$ =$1 ; }
3450
+ | update_target_lists_list ' ,' update_target_lists_el {$$ = cat_str(3 ,$1 , make_str(" ," ),$3 ); }
3451
+ ;
3452
+
3453
+ update_target_lists_el :
3454
+ ' (' update_col_list ' )' ' =' ' (' update_value_list ' )'
3455
+ {
3456
+ $$ = cat_str(5 , make_str(" (" ),$2 , make_str(" )=(" ),$6 , make_str(" )" ));
3457
+ }
3458
+ ;
3459
+
3460
+ update_col_list :
3461
+ update_col_list_el {$$ =$1 ; }
3462
+ | update_col_list ' ,' update_col_list_el {$$ = cat_str(3 ,$1 , make_str(" ," ),$3 ); }
3463
+ ;
3464
+
3465
+ update_col_list_el :
3466
+ ColId opt_indirection
3467
+ {
3468
+ $$ = cat2_str($1 ,$2 );
3469
+ }
3470
+ ;
3471
+
3472
+ update_value_list :
3473
+ values_item {$$ =$1 ; }
3474
+ | update_value_list ' ,' values_item {$$ = cat_str(3 ,$1 , make_str(" ," ),$3 ); }
3475
+ ;
3476
+
3436
3477
/* ****************************************************************************
3437
3478
*
3438
3479
*clauses common to all Optimizable Stmts:
@@ -4337,6 +4378,7 @@ target_el:a_expr AS ColLabel
4337
4378
/* Target list as found in UPDATE table SET ...*/
4338
4379
update_target_list :update_target_list ' ,' update_target_el
4339
4380
{$$ = cat_str(3 ,$1 , make_str(" ," ),$3 );}
4381
+ /* INFORMIX workaround, no longer needed
4340
4382
| '(' inf_col_list ')' '=' '(' inf_val_list ')'
4341
4383
{
4342
4384
struct inf_compat_col *ptrc;
@@ -4360,12 +4402,12 @@ update_target_list: update_target_list ',' update_target_el
4360
4402
vals = cat_str( 3, vals, ptrv->val, make_str(")") );
4361
4403
}
4362
4404
$$ = cat_str( 3, cols, make_str("="), vals );
4363
- }
4405
+ }*/
4364
4406
| update_target_el
4365
4407
{$$ =$1 ;}
4366
4408
;
4367
4409
4368
- inf_col_list :ColId opt_indirection
4410
+ /* inf_col_list: ColId opt_indirection
4369
4411
{
4370
4412
struct inf_compat_col *ptr = mm_alloc(sizeof(struct inf_compat_col));
4371
4413
@@ -4402,6 +4444,7 @@ inf_val_list: a_expr
4402
4444
informix_val = ptr;
4403
4445
}
4404
4446
;
4447
+ */
4405
4448
4406
4449
update_target_el :ColId opt_indirection ' =' a_expr
4407
4450
{$$ = cat_str(4 ,$1 ,$2 , make_str(" =" ),$4 ); }
@@ -6216,6 +6259,7 @@ ECPGunreserved_con: ABORT_P{ $$ = make_str("abort"); }
6216
6259
| COMMENT {$$ = make_str(" comment" ); }
6217
6260
| COMMIT {$$ = make_str(" commit" ); }
6218
6261
| COMMITTED {$$ = make_str(" committed" ); }
6262
+ | CONCURRENTLY {$$ = make_str(" concurrently" ); }
6219
6263
/* | CONNECTION{ $$ = make_str("connection"); }*/
6220
6264
| CONSTRAINTS {$$ = make_str(" constraints" ); }
6221
6265
| CONVERSION_P {$$ = make_str(" conversion" ); }