@@ -318,6 +318,11 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
318
318
%type <list> opt_qualified_name
319
319
%type <boolean> opt_concurrently
320
320
%type <dbehavior> opt_drop_behavior
321
+ %type <list> opt_utility_option_list
322
+ %type <list> utility_option_list
323
+ %type <defelt> utility_option_elem
324
+ %type <str> utility_option_name
325
+ %type <node> utility_option_arg
321
326
322
327
%type <node> alter_column_default opclass_item opclass_drop alter_using
323
328
%type <ival> add_drop opt_asc_desc opt_nulls_order
@@ -338,10 +343,6 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
338
343
create_extension_opt_item alter_extension_opt_item
339
344
340
345
%type <ival> opt_lock lock_type cast_context
341
- %type <str> utility_option_name
342
- %type <defelt> utility_option_elem
343
- %type <list> utility_option_list
344
- %type <node> utility_option_arg
345
346
%type <defelt> drop_option
346
347
%type <boolean> opt_or_replace opt_no
347
348
opt_grant_grant_option
@@ -556,7 +557,6 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
556
557
%type <list> generic_option_list alter_generic_option_list
557
558
558
559
%type <ival> reindex_target_relation reindex_target_all
559
- %type <list> opt_reindex_option_list
560
560
561
561
%type <node> copy_generic_opt_arg copy_generic_opt_arg_list_item
562
562
%type <defelt> copy_generic_opt_elem
@@ -1141,6 +1141,41 @@ opt_drop_behavior:
1141
1141
| /* EMPTY */ { $$ = DROP_RESTRICT; /* default */ }
1142
1142
;
1143
1143
1144
+ opt_utility_option_list :
1145
+ ' (' utility_option_list ' )' { $$ = $2 ; }
1146
+ | /* EMPTY */ { $$ = NULL ; }
1147
+ ;
1148
+
1149
+ utility_option_list :
1150
+ utility_option_elem
1151
+ {
1152
+ $$ = list_make1($1 );
1153
+ }
1154
+ | utility_option_list ' ,' utility_option_elem
1155
+ {
1156
+ $$ = lappend($1 , $3 );
1157
+ }
1158
+ ;
1159
+
1160
+ utility_option_elem :
1161
+ utility_option_name utility_option_arg
1162
+ {
1163
+ $$ = makeDefElem($1 , $2 , @1 );
1164
+ }
1165
+ ;
1166
+
1167
+ utility_option_name :
1168
+ NonReservedWord { $$ = $1 ; }
1169
+ | analyze_keyword { $$ = " analyze" ; }
1170
+ | FORMAT_LA { $$ = " format" ; }
1171
+ ;
1172
+
1173
+ utility_option_arg :
1174
+ opt_boolean_or_string { $$ = (Node *) makeString($1 ); }
1175
+ | NumericOnly { $$ = (Node *) $1 ; }
1176
+ | /* EMPTY */ { $$ = NULL ; }
1177
+ ;
1178
+
1144
1179
/* ****************************************************************************
1145
1180
*
1146
1181
* CALL statement
@@ -2028,18 +2063,12 @@ constraints_set_mode:
2028
2063
* Checkpoint statement
2029
2064
*/
2030
2065
CheckPointStmt :
2031
- CHECKPOINT
2066
+ CHECKPOINT opt_utility_option_list
2032
2067
{
2033
2068
CheckPointStmt *n = makeNode(CheckPointStmt);
2034
2069
2035
2070
$$ = (Node *) n;
2036
- }
2037
- | CHECKPOINT ' (' utility_option_list ' )'
2038
- {
2039
- CheckPointStmt *n = makeNode(CheckPointStmt);
2040
-
2041
- $$ = (Node *) n;
2042
- n->options = $3 ;
2071
+ n->options = $2 ;
2043
2072
}
2044
2073
;
2045
2074
@@ -9354,7 +9383,7 @@ DropTransformStmt: DROP TRANSFORM opt_if_exists FOR Typename LANGUAGE name opt_d
9354
9383
*****************************************************************************/
9355
9384
9356
9385
ReindexStmt :
9357
- REINDEX opt_reindex_option_list reindex_target_relation opt_concurrently qualified_name
9386
+ REINDEX opt_utility_option_list reindex_target_relation opt_concurrently qualified_name
9358
9387
{
9359
9388
ReindexStmt *n = makeNode(ReindexStmt);
9360
9389
@@ -9367,7 +9396,7 @@ ReindexStmt:
9367
9396
makeDefElem (" concurrently" , NULL , @4 ));
9368
9397
$$ = (Node *) n;
9369
9398
}
9370
- | REINDEX opt_reindex_option_list SCHEMA opt_concurrently name
9399
+ | REINDEX opt_utility_option_list SCHEMA opt_concurrently name
9371
9400
{
9372
9401
ReindexStmt *n = makeNode(ReindexStmt);
9373
9402
@@ -9380,7 +9409,7 @@ ReindexStmt:
9380
9409
makeDefElem (" concurrently" , NULL , @4 ));
9381
9410
$$ = (Node *) n;
9382
9411
}
9383
- | REINDEX opt_reindex_option_list reindex_target_all opt_concurrently opt_single_name
9412
+ | REINDEX opt_utility_option_list reindex_target_all opt_concurrently opt_single_name
9384
9413
{
9385
9414
ReindexStmt *n = makeNode(ReindexStmt);
9386
9415
@@ -9402,10 +9431,6 @@ reindex_target_all:
9402
9431
SYSTEM_P { $$ = REINDEX_OBJECT_SYSTEM; }
9403
9432
| DATABASE { $$ = REINDEX_OBJECT_DATABASE; }
9404
9433
;
9405
- opt_reindex_option_list :
9406
- ' (' utility_option_list ' )' { $$ = $2 ; }
9407
- | /* EMPTY */ { $$ = NULL ; }
9408
- ;
9409
9434
9410
9435
/* ****************************************************************************
9411
9436
*
@@ -11903,13 +11928,13 @@ ClusterStmt:
11903
11928
n->params = $3 ;
11904
11929
$$ = (Node *) n;
11905
11930
}
11906
- | CLUSTER ' ( ' utility_option_list ' ) '
11931
+ | CLUSTER opt_utility_option_list
11907
11932
{
11908
11933
ClusterStmt *n = makeNode(ClusterStmt);
11909
11934
11910
11935
n->relation = NULL ;
11911
11936
n->indexname = NULL ;
11912
- n->params = $3 ;
11937
+ n->params = $2 ;
11913
11938
$$ = (Node *) n;
11914
11939
}
11915
11940
/* unparenthesized VERBOSE kept for pre-14 compatibility */
@@ -11919,21 +11944,18 @@ ClusterStmt:
11919
11944
11920
11945
n->relation = $3 ;
11921
11946
n->indexname = $4 ;
11922
- n->params = NIL;
11923
11947
if ($2 )
11924
- n->params = lappend(n->params, makeDefElem(" verbose" , NULL , @2 ));
11948
+ n->params = list_make1( makeDefElem(" verbose" , NULL , @2 ));
11925
11949
$$ = (Node *) n;
11926
11950
}
11927
11951
/* unparenthesized VERBOSE kept for pre-17 compatibility */
11928
- | CLUSTER opt_verbose
11952
+ | CLUSTER VERBOSE
11929
11953
{
11930
11954
ClusterStmt *n = makeNode(ClusterStmt);
11931
11955
11932
11956
n->relation = NULL ;
11933
11957
n->indexname = NULL ;
11934
- n->params = NIL;
11935
- if ($2 )
11936
- n->params = lappend(n->params, makeDefElem(" verbose" , NULL , @2 ));
11958
+ n->params = list_make1(makeDefElem(" verbose" , NULL , @2 ));
11937
11959
$$ = (Node *) n;
11938
11960
}
11939
11961
/* kept for pre-8.3 compatibility */
@@ -11943,9 +11965,8 @@ ClusterStmt:
11943
11965
11944
11966
n->relation = $5 ;
11945
11967
n->indexname = $3 ;
11946
- n->params = NIL;
11947
11968
if ($2 )
11948
- n->params = lappend(n->params, makeDefElem(" verbose" , NULL , @2 ));
11969
+ n->params = list_make1( makeDefElem(" verbose" , NULL , @2 ));
11949
11970
$$ = (Node *) n;
11950
11971
}
11951
11972
;
@@ -11996,64 +12017,31 @@ VacuumStmt: VACUUM opt_full opt_freeze opt_verbose opt_analyze opt_vacuum_relati
11996
12017
}
11997
12018
;
11998
12019
11999
- AnalyzeStmt : analyze_keyword opt_verbose opt_vacuum_relation_list
12020
+ AnalyzeStmt : analyze_keyword opt_utility_option_list opt_vacuum_relation_list
12000
12021
{
12001
12022
VacuumStmt *n = makeNode(VacuumStmt);
12002
12023
12003
- n->options = NIL;
12004
- if ($2 )
12005
- n->options = lappend(n->options,
12006
- makeDefElem (" verbose" , NULL , @2 ));
12024
+ n->options = $2 ;
12007
12025
n->rels = $3 ;
12008
12026
n->is_vacuumcmd = false ;
12009
12027
$$ = (Node *) n;
12010
12028
}
12011
- | analyze_keyword ' ( ' utility_option_list ' ) ' opt_vacuum_relation_list
12029
+ | analyze_keyword VERBOSE opt_vacuum_relation_list
12012
12030
{
12013
12031
VacuumStmt *n = makeNode(VacuumStmt);
12014
12032
12015
- n->options = $3 ;
12016
- n->rels = $5 ;
12033
+ n->options = list_make1(makeDefElem( " verbose " , NULL , @2 )) ;
12034
+ n->rels = $3 ;
12017
12035
n->is_vacuumcmd = false ;
12018
12036
$$ = (Node *) n;
12019
12037
}
12020
12038
;
12021
12039
12022
- utility_option_list :
12023
- utility_option_elem
12024
- {
12025
- $$ = list_make1($1 );
12026
- }
12027
- | utility_option_list ' ,' utility_option_elem
12028
- {
12029
- $$ = lappend($1 , $3 );
12030
- }
12031
- ;
12032
-
12033
12040
analyze_keyword :
12034
12041
ANALYZE
12035
12042
| ANALYSE /* British */
12036
12043
;
12037
12044
12038
- utility_option_elem :
12039
- utility_option_name utility_option_arg
12040
- {
12041
- $$ = makeDefElem($1 , $2 , @1 );
12042
- }
12043
- ;
12044
-
12045
- utility_option_name :
12046
- NonReservedWord { $$ = $1 ; }
12047
- | analyze_keyword { $$ = " analyze" ; }
12048
- | FORMAT_LA { $$ = " format" ; }
12049
- ;
12050
-
12051
- utility_option_arg :
12052
- opt_boolean_or_string { $$ = (Node *) makeString($1 ); }
12053
- | NumericOnly { $$ = (Node *) $1 ; }
12054
- | /* EMPTY */ { $$ = NULL ; }
12055
- ;
12056
-
12057
12045
opt_analyze :
12058
12046
analyze_keyword { $$ = true ; }
12059
12047
| /* EMPTY*/ { $$ = false ; }
0 commit comments