@@ -426,9 +426,10 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
426
426
427
427
%type <ival> Iconst SignedIconst
428
428
%type <str> Sconst comment_text notify_payload
429
- %type <str> RoleId opt_granted_by opt_boolean_or_string ColId_or_Sconst
429
+ %type <str> RoleId opt_granted_by opt_boolean_or_string
430
430
%type <list> var_list
431
431
%type <str> ColId ColLabel var_name type_function_name param_name
432
+ %type <str> NonReservedWord NonReservedWord_or_Sconst
432
433
%type <node> var_value zone_value
433
434
434
435
%type <keyword> unreserved_keyword type_func_name_keyword
@@ -1321,15 +1322,15 @@ set_rest:/* Generic SET syntaxes: */
1321
1322
n->kind = VAR_SET_DEFAULT;
1322
1323
$$ = n;
1323
1324
}
1324
- | ROLE ColId_or_Sconst
1325
+ | ROLE NonReservedWord_or_Sconst
1325
1326
{
1326
1327
VariableSetStmt *n = makeNode(VariableSetStmt);
1327
1328
n->kind = VAR_SET_VALUE;
1328
1329
n->name =" role" ;
1329
1330
n->args = list_make1(makeStringConst($2 ,@2 ));
1330
1331
$$ = n;
1331
1332
}
1332
- | SESSION AUTHORIZATION ColId_or_Sconst
1333
+ | SESSION AUTHORIZATION NonReservedWord_or_Sconst
1333
1334
{
1334
1335
VariableSetStmt *n = makeNode(VariableSetStmt);
1335
1336
n->kind = VAR_SET_VALUE;
@@ -1383,11 +1384,11 @@ opt_boolean_or_string:
1383
1384
| FALSE_P {$$ =" false" ; }
1384
1385
| ON {$$ =" on" ; }
1385
1386
/*
1386
- * OFF is also accepted as a boolean value, but is handled
1387
- *by theColId rule below. The action for booleans and strings
1387
+ * OFF is also accepted as a boolean value, but is handled by
1388
+ * theNonReservedWord rule. The action for booleans and strings
1388
1389
* is the same, so we don't need to distinguish them here.
1389
1390
*/
1390
- | ColId_or_Sconst {$$ =$1 ; }
1391
+ | NonReservedWord_or_Sconst {$$ =$1 ; }
1391
1392
;
1392
1393
1393
1394
/* Timezone values can be:
@@ -1456,8 +1457,8 @@ opt_encoding:
1456
1457
| /* EMPTY*/ {$$ =NULL ; }
1457
1458
;
1458
1459
1459
- ColId_or_Sconst :
1460
- ColId {$$ =$1 ; }
1460
+ NonReservedWord_or_Sconst :
1461
+ NonReservedWord {$$ =$1 ; }
1461
1462
| Sconst {$$ =$1 ; }
1462
1463
;
1463
1464
@@ -3177,7 +3178,7 @@ NumericOnly_list:NumericOnly{ $$ = list_make1($1); }
3177
3178
*****************************************************************************/
3178
3179
3179
3180
CreatePLangStmt :
3180
- CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
3181
+ CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE NonReservedWord_or_Sconst
3181
3182
{
3182
3183
CreatePLangStmt *n = makeNode(CreatePLangStmt);
3183
3184
n->replace =$2 ;
@@ -3189,7 +3190,7 @@ CreatePLangStmt:
3189
3190
n->pltrusted =false ;
3190
3191
$$ = (Node *)n;
3191
3192
}
3192
- | CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
3193
+ | CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE NonReservedWord_or_Sconst
3193
3194
HANDLER handler_name opt_inline_handler opt_validator
3194
3195
{
3195
3196
CreatePLangStmt *n = makeNode(CreatePLangStmt);
@@ -3233,15 +3234,15 @@ opt_validator:
3233
3234
;
3234
3235
3235
3236
DropPLangStmt :
3236
- DROP opt_procedural LANGUAGE ColId_or_Sconst opt_drop_behavior
3237
+ DROP opt_procedural LANGUAGE NonReservedWord_or_Sconst opt_drop_behavior
3237
3238
{
3238
3239
DropPLangStmt *n = makeNode(DropPLangStmt);
3239
3240
n->plname =$4 ;
3240
3241
n->behavior =$5 ;
3241
3242
n->missing_ok =false ;
3242
3243
$$ = (Node *)n;
3243
3244
}
3244
- | DROP opt_procedural LANGUAGE IF_P EXISTS ColId_or_Sconst opt_drop_behavior
3245
+ | DROP opt_procedural LANGUAGE IF_P EXISTS NonReservedWord_or_Sconst opt_drop_behavior
3245
3246
{
3246
3247
DropPLangStmt *n = makeNode(DropPLangStmt);
3247
3248
n->plname =$6 ;
@@ -3341,11 +3342,11 @@ create_extension_opt_item:
3341
3342
{
3342
3343
$$ = makeDefElem(" schema" , (Node *)makeString($2 ));
3343
3344
}
3344
- | VERSION_P ColId_or_Sconst
3345
+ | VERSION_P NonReservedWord_or_Sconst
3345
3346
{
3346
3347
$$ = makeDefElem(" new_version" , (Node *)makeString($2 ));
3347
3348
}
3348
- | FROM ColId_or_Sconst
3349
+ | FROM NonReservedWord_or_Sconst
3349
3350
{
3350
3351
$$ = makeDefElem(" old_version" , (Node *)makeString($2 ));
3351
3352
}
@@ -3374,7 +3375,7 @@ alter_extension_opt_list:
3374
3375
;
3375
3376
3376
3377
alter_extension_opt_item :
3377
- TO ColId_or_Sconst
3378
+ TO NonReservedWord_or_Sconst
3378
3379
{
3379
3380
$$ = makeDefElem(" new_version" , (Node *)makeString($2 ));
3380
3381
}
@@ -5061,8 +5062,8 @@ SecLabelStmt:
5061
5062
}
5062
5063
;
5063
5064
5064
- opt_provider :FOR ColId_or_Sconst {$$ =$2 ; }
5065
- | /* empty*/ {$$ =NULL ; }
5065
+ opt_provider :FOR NonReservedWord_or_Sconst {$$ =$2 ; }
5066
+ | /* empty*/ {$$ =NULL ; }
5066
5067
;
5067
5068
5068
5069
security_label_type :
@@ -6051,7 +6052,7 @@ createfunc_opt_item:
6051
6052
{
6052
6053
$$ = makeDefElem(" as" , (Node *)$2 );
6053
6054
}
6054
- | LANGUAGE ColId_or_Sconst
6055
+ | LANGUAGE NonReservedWord_or_Sconst
6055
6056
{
6056
6057
$$ = makeDefElem(" language" , (Node *)makeString($2 ));
6057
6058
}
@@ -6260,7 +6261,7 @@ dostmt_opt_item:
6260
6261
{
6261
6262
$$ = makeDefElem(" as" , (Node *)makeString($1 ));
6262
6263
}
6263
- | LANGUAGE ColId_or_Sconst
6264
+ | LANGUAGE NonReservedWord_or_Sconst
6264
6265
{
6265
6266
$$ = makeDefElem(" language" , (Node *)makeString($2 ));
6266
6267
}
@@ -7918,9 +7919,7 @@ explain_option_elem:
7918
7919
;
7919
7920
7920
7921
explain_option_name :
7921
- ColId {$$ =$1 ; }
7922
- | analyze_keyword {$$ =" analyze" ; }
7923
- | VERBOSE {$$ =" verbose" ; }
7922
+ NonReservedWord {$$ =$1 ; }
7924
7923
;
7925
7924
7926
7925
explain_option_arg :
@@ -11781,7 +11780,7 @@ AexprConst: Iconst
11781
11780
11782
11781
Iconst:ICONST{ $$ = $1 ; };
11783
11782
Sconst:SCONST{ $$ = $1 ; };
11784
- RoleId:ColId { $$ = $1 ; };
11783
+ RoleId:NonReservedWord { $$ = $1 ; };
11785
11784
11786
11785
SignedIconst: Iconst{ $$ = $1 ; }
11787
11786
|' +' Iconst{ $$ = + $2 ; }
@@ -11813,6 +11812,14 @@ type_function_name:IDENT{ $$ = $1; }
11813
11812
| type_func_name_keyword{ $$ =pstrdup ($1 ); }
11814
11813
;
11815
11814
11815
+ /* Any not-fully-reserved word --- these names can be, eg, role names.
11816
+ */
11817
+ NonReservedWord:IDENT{ $$ = $1 ; }
11818
+ | unreserved_keyword{ $$ =pstrdup ($1 ); }
11819
+ | col_name_keyword{ $$ =pstrdup ($1 ); }
11820
+ | type_func_name_keyword{ $$ =pstrdup ($1 ); }
11821
+ ;
11822
+
11816
11823
/* Column label --- allowed labels in "AS" clauses.
11817
11824
* This presently includes *all* Postgres keywords.
11818
11825
*/