@@ -334,6 +334,11 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
334
334
simple_select values_clause
335
335
PLpgSQL_Expr PLAssignStmt
336
336
337
+ %type <str> opt_single_name
338
+ %type <list> opt_qualified_name
339
+ %type <boolean> opt_concurrently
340
+ %type <dbehavior> opt_drop_behavior
341
+
337
342
%type <node> alter_column_default opclass_item opclass_drop alter_using
338
343
%type <ival> add_drop opt_asc_desc opt_nulls_order
339
344
@@ -343,8 +348,6 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
343
348
%type <list> alter_identity_column_option_list
344
349
%type <defelt> alter_identity_column_option
345
350
346
- %type <dbehavior> opt_drop_behavior
347
-
348
351
%type <list> createdb_opt_list createdb_opt_items copy_opt_list
349
352
transaction_mode_list
350
353
create_extension_opt_list alter_extension_opt_list
@@ -371,7 +374,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
371
374
%type <str> foreign_server_version opt_foreign_server_version
372
375
%type <str> opt_in_database
373
376
374
- %type <str> OptSchemaName parameter_name
377
+ %type <str> parameter_name
375
378
%type <list> OptSchemaEltList parameter_name_list
376
379
377
380
%type <chr> am_type
@@ -392,10 +395,10 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
392
395
%type <str> copy_file_name
393
396
access_method_clause attr_name
394
397
table_access_method_clause name cursor_name file_name
395
- opt_index_name cluster_index_specification
398
+ cluster_index_specification
396
399
397
400
%type <list> func_name handler_name qual_Op qual_all_Op subquery_Op
398
- opt_class opt_inline_handler opt_validator validator_clause
401
+ opt_inline_handler opt_validator validator_clause
399
402
opt_collate
400
403
401
404
%type <range> qualified_name insert_target OptConstrFromTable
@@ -435,7 +438,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
435
438
oper_argtypes RuleActionList RuleActionMulti
436
439
opt_column_list columnList opt_name_list
437
440
sort_clause opt_sort_clause sortby_list index_params
438
- opt_stats_name stats_params
441
+ stats_params
439
442
opt_include opt_c_include index_including_params
440
443
name_list role_list from_clause from_list opt_array_bounds
441
444
qualified_name_list any_name any_name_list type_name_list
@@ -495,7 +498,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
495
498
%type <str> unicode_normal_form
496
499
497
500
%type <boolean> opt_instead
498
- %type <boolean> opt_unique opt_concurrently opt_verbose opt_full
501
+ %type <boolean> opt_unique opt_verbose opt_full
499
502
%type <boolean> opt_freeze opt_analyze opt_default opt_recheck
500
503
%type <defelt> opt_binary copy_delimiter
501
504
@@ -1180,6 +1183,30 @@ stmt:
1180
1183
{ $$ = NULL ; }
1181
1184
;
1182
1185
1186
+ /*
1187
+ * Generic supporting productions for DDL
1188
+ */
1189
+ opt_single_name :
1190
+ ColId { $$ = $1 ; }
1191
+ | /* EMPTY */ { $$ = NULL ; }
1192
+ ;
1193
+
1194
+ opt_qualified_name :
1195
+ any_name { $$ = $1 ; }
1196
+ | /* EMPTY*/ { $$ = NIL; }
1197
+ ;
1198
+
1199
+ opt_concurrently :
1200
+ CONCURRENTLY { $$ = true ; }
1201
+ | /* EMPTY*/ { $$ = false ; }
1202
+ ;
1203
+
1204
+ opt_drop_behavior :
1205
+ CASCADE { $$ = DROP_CASCADE; }
1206
+ | RESTRICT { $$ = DROP_RESTRICT; }
1207
+ | /* EMPTY */ { $$ = DROP_RESTRICT; /* default */ }
1208
+ ;
1209
+
1183
1210
/* ****************************************************************************
1184
1211
*
1185
1212
* CALL statement
@@ -1554,7 +1581,7 @@ add_drop: ADD_P { $$ = +1; }
1554
1581
*****************************************************************************/
1555
1582
1556
1583
CreateSchemaStmt :
1557
- CREATE SCHEMA OptSchemaName AUTHORIZATION RoleSpec OptSchemaEltList
1584
+ CREATE SCHEMA opt_single_name AUTHORIZATION RoleSpec OptSchemaEltList
1558
1585
{
1559
1586
CreateSchemaStmt *n = makeNode(CreateSchemaStmt);
1560
1587
@@ -1576,7 +1603,7 @@ CreateSchemaStmt:
1576
1603
n->if_not_exists = false ;
1577
1604
$$ = (Node *) n;
1578
1605
}
1579
- | CREATE SCHEMA IF_P NOT EXISTS OptSchemaName AUTHORIZATION RoleSpec OptSchemaEltList
1606
+ | CREATE SCHEMA IF_P NOT EXISTS opt_single_name AUTHORIZATION RoleSpec OptSchemaEltList
1580
1607
{
1581
1608
CreateSchemaStmt *n = makeNode(CreateSchemaStmt);
1582
1609
@@ -1610,11 +1637,6 @@ CreateSchemaStmt:
1610
1637
}
1611
1638
;
1612
1639
1613
- OptSchemaName :
1614
- ColId { $$ = $1 ; }
1615
- | /* EMPTY */ { $$ = NULL ; }
1616
- ;
1617
-
1618
1640
OptSchemaEltList :
1619
1641
OptSchemaEltList schema_stmt
1620
1642
{
@@ -2995,12 +3017,6 @@ alter_column_default:
2995
3017
| DROP DEFAULT { $$ = NULL ; }
2996
3018
;
2997
3019
2998
- opt_drop_behavior :
2999
- CASCADE { $$ = DROP_CASCADE; }
3000
- | RESTRICT { $$ = DROP_RESTRICT; }
3001
- | /* EMPTY */ { $$ = DROP_RESTRICT; /* default */ }
3002
- ;
3003
-
3004
3020
opt_collate_clause :
3005
3021
COLLATE any_name
3006
3022
{
@@ -4467,7 +4483,7 @@ part_params: part_elem { $$ = list_make1($1); }
4467
4483
| part_params ' ,' part_elem { $$ = lappend($1 , $3 ); }
4468
4484
;
4469
4485
4470
- part_elem : ColId opt_collate opt_class
4486
+ part_elem : ColId opt_collate opt_qualified_name
4471
4487
{
4472
4488
PartitionElem *n = makeNode(PartitionElem);
4473
4489
@@ -4478,7 +4494,7 @@ part_elem: ColId opt_collate opt_class
4478
4494
n->location = @1 ;
4479
4495
$$ = n;
4480
4496
}
4481
- | func_expr_windowless opt_collate opt_class
4497
+ | func_expr_windowless opt_collate opt_qualified_name
4482
4498
{
4483
4499
PartitionElem *n = makeNode(PartitionElem);
4484
4500
@@ -4489,7 +4505,7 @@ part_elem: ColId opt_collate opt_class
4489
4505
n->location = @1 ;
4490
4506
$$ = n;
4491
4507
}
4492
- | ' (' a_expr ' )' opt_collate opt_class
4508
+ | ' (' a_expr ' )' opt_collate opt_qualified_name
4493
4509
{
4494
4510
PartitionElem *n = makeNode(PartitionElem);
4495
4511
@@ -4543,10 +4559,12 @@ ExistingIndex: USING INDEX name { $$ = $3; }
4543
4559
* but the grammar accepts it and then we'll throw FEATURE_NOT_SUPPORTED
4544
4560
* errors as necessary at execution.
4545
4561
*
4562
+ * Statistics name is optional unless IF NOT EXISTS is specified.
4563
+ *
4546
4564
*****************************************************************************/
4547
4565
4548
4566
CreateStatsStmt :
4549
- CREATE STATISTICS opt_stats_name
4567
+ CREATE STATISTICS opt_qualified_name
4550
4568
opt_name_list ON stats_params FROM from_list
4551
4569
{
4552
4570
CreateStatsStmt *n = makeNode(CreateStatsStmt);
@@ -4574,12 +4592,6 @@ CreateStatsStmt:
4574
4592
}
4575
4593
;
4576
4594
4577
- /* Statistics name is optional unless IF NOT EXISTS is specified */
4578
- opt_stats_name :
4579
- any_name { $$ = $1 ; }
4580
- | /* EMPTY*/ { $$ = NULL ; }
4581
- ;
4582
-
4583
4595
/*
4584
4596
* Statistics attributes can be either simple column references, or arbitrary
4585
4597
* expressions in parens. For compatibility with index attributes permitted
@@ -7987,7 +7999,7 @@ defacl_privilege_target:
7987
7999
* willing to make TABLESPACE a fully reserved word.
7988
8000
*****************************************************************************/
7989
8001
7990
- IndexStmt : CREATE opt_unique INDEX opt_concurrently opt_index_name
8002
+ IndexStmt : CREATE opt_unique INDEX opt_concurrently opt_single_name
7991
8003
ON relation_expr access_method_clause ' (' index_params ' )'
7992
8004
opt_include opt_unique_null_treatment opt_reloptions OptTableSpace where_clause
7993
8005
{
@@ -8058,16 +8070,6 @@ opt_unique:
8058
8070
| /* EMPTY*/ { $$ = false ; }
8059
8071
;
8060
8072
8061
- opt_concurrently :
8062
- CONCURRENTLY { $$ = true ; }
8063
- | /* EMPTY*/ { $$ = false ; }
8064
- ;
8065
-
8066
- opt_index_name :
8067
- name { $$ = $1 ; }
8068
- | /* EMPTY*/ { $$ = NULL ; }
8069
- ;
8070
-
8071
8073
access_method_clause :
8072
8074
USING name { $$ = $2 ; }
8073
8075
| /* EMPTY*/ { $$ = DEFAULT_INDEX_TYPE; }
@@ -8079,7 +8081,7 @@ index_params: index_elem { $$ = list_make1($1); }
8079
8081
8080
8082
8081
8083
index_elem_options :
8082
- opt_collate opt_class opt_asc_desc opt_nulls_order
8084
+ opt_collate opt_qualified_name opt_asc_desc opt_nulls_order
8083
8085
{
8084
8086
$$ = makeNode(IndexElem);
8085
8087
$$ ->name = NULL ;
@@ -8139,9 +8141,6 @@ opt_collate: COLLATE any_name { $$ = $2; }
8139
8141
| /* EMPTY*/ { $$ = NIL; }
8140
8142
;
8141
8143
8142
- opt_class : any_name { $$ = $1 ; }
8143
- | /* EMPTY*/ { $$ = NIL; }
8144
- ;
8145
8144
8146
8145
opt_asc_desc : ASC { $$ = SORTBY_ASC; }
8147
8146
| DESC { $$ = SORTBY_DESC; }
0 commit comments