@@ -401,9 +401,10 @@ static TypeName *TableFuncTypeName(List *columns);
401
401
402
402
%type <ival> Iconst SignedIconst
403
403
%type <str> Sconst comment_text notify_payload
404
- %type <str> RoleId opt_granted_by opt_boolean_or_string ColId_or_Sconst
404
+ %type <str> RoleId opt_granted_by opt_boolean_or_string
405
405
%type <list> var_list
406
406
%type <str> ColId ColLabel var_name type_function_name param_name
407
+ %type <str> NonReservedWord NonReservedWord_or_Sconst
407
408
%type <node> var_value zone_value
408
409
409
410
%type <keyword> unreserved_keyword type_func_name_keyword
@@ -1275,15 +1276,15 @@ set_rest: /* Generic SET syntaxes: */
1275
1276
n->kind = VAR_SET_DEFAULT;
1276
1277
$$ = n;
1277
1278
}
1278
- | ROLE ColId_or_Sconst
1279
+ | ROLE NonReservedWord_or_Sconst
1279
1280
{
1280
1281
VariableSetStmt *n = makeNode(VariableSetStmt);
1281
1282
n->kind = VAR_SET_VALUE;
1282
1283
n->name = " role" ;
1283
1284
n->args = list_make1(makeStringConst($2 , @2 ));
1284
1285
$$ = n;
1285
1286
}
1286
- | SESSION AUTHORIZATION ColId_or_Sconst
1287
+ | SESSION AUTHORIZATION NonReservedWord_or_Sconst
1287
1288
{
1288
1289
VariableSetStmt *n = makeNode(VariableSetStmt);
1289
1290
n->kind = VAR_SET_VALUE;
@@ -1337,11 +1338,11 @@ opt_boolean_or_string:
1337
1338
| FALSE_P { $$ = " false" ; }
1338
1339
| ON { $$ = " on" ; }
1339
1340
/*
1340
- * OFF is also accepted as a boolean value, but is handled
1341
- * by the ColId rule below. The action for booleans and strings
1341
+ * OFF is also accepted as a boolean value, but is handled by
1342
+ * the NonReservedWord rule. The action for booleans and strings
1342
1343
* is the same, so we don't need to distinguish them here.
1343
1344
*/
1344
- | ColId_or_Sconst { $$ = $1 ; }
1345
+ | NonReservedWord_or_Sconst { $$ = $1 ; }
1345
1346
;
1346
1347
1347
1348
/* Timezone values can be:
@@ -1410,8 +1411,8 @@ opt_encoding:
1410
1411
| /* EMPTY*/ { $$ = NULL ; }
1411
1412
;
1412
1413
1413
- ColId_or_Sconst :
1414
- ColId { $$ = $1 ; }
1414
+ NonReservedWord_or_Sconst :
1415
+ NonReservedWord { $$ = $1 ; }
1415
1416
| Sconst { $$ = $1 ; }
1416
1417
;
1417
1418
@@ -2894,7 +2895,7 @@ NumericOnly_list: NumericOnly { $$ = list_make1($1); }
2894
2895
*****************************************************************************/
2895
2896
2896
2897
CreatePLangStmt :
2897
- CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
2898
+ CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE NonReservedWord_or_Sconst
2898
2899
{
2899
2900
CreatePLangStmt *n = makeNode(CreatePLangStmt);
2900
2901
n->replace = $2 ;
@@ -2906,7 +2907,7 @@ CreatePLangStmt:
2906
2907
n->pltrusted = false ;
2907
2908
$$ = (Node *)n;
2908
2909
}
2909
- | CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
2910
+ | CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE NonReservedWord_or_Sconst
2910
2911
HANDLER handler_name opt_inline_handler opt_validator
2911
2912
{
2912
2913
CreatePLangStmt *n = makeNode(CreatePLangStmt);
@@ -2950,15 +2951,15 @@ opt_validator:
2950
2951
;
2951
2952
2952
2953
DropPLangStmt :
2953
- DROP opt_procedural LANGUAGE ColId_or_Sconst opt_drop_behavior
2954
+ DROP opt_procedural LANGUAGE NonReservedWord_or_Sconst opt_drop_behavior
2954
2955
{
2955
2956
DropPLangStmt *n = makeNode(DropPLangStmt);
2956
2957
n->plname = $4 ;
2957
2958
n->behavior = $5 ;
2958
2959
n->missing_ok = false ;
2959
2960
$$ = (Node *)n;
2960
2961
}
2961
- | DROP opt_procedural LANGUAGE IF_P EXISTS ColId_or_Sconst opt_drop_behavior
2962
+ | DROP opt_procedural LANGUAGE IF_P EXISTS NonReservedWord_or_Sconst opt_drop_behavior
2962
2963
{
2963
2964
DropPLangStmt *n = makeNode(DropPLangStmt);
2964
2965
n->plname = $6 ;
@@ -5256,7 +5257,7 @@ createfunc_opt_item:
5256
5257
{
5257
5258
$$ = makeDefElem(" as" , (Node *)$2 );
5258
5259
}
5259
- | LANGUAGE ColId_or_Sconst
5260
+ | LANGUAGE NonReservedWord_or_Sconst
5260
5261
{
5261
5262
$$ = makeDefElem(" language" , (Node *)makeString($2 ));
5262
5263
}
@@ -5465,7 +5466,7 @@ dostmt_opt_item:
5465
5466
{
5466
5467
$$ = makeDefElem(" as" , (Node *)makeString($1 ));
5467
5468
}
5468
- | LANGUAGE ColId_or_Sconst
5469
+ | LANGUAGE NonReservedWord_or_Sconst
5469
5470
{
5470
5471
$$ = makeDefElem(" language" , (Node *)makeString($2 ));
5471
5472
}
@@ -6978,9 +6979,7 @@ explain_option_elem:
6978
6979
;
6979
6980
6980
6981
explain_option_name:
6981
- ColId { $$ = $1 ; }
6982
- | analyze_keyword { $$ = " analyze" ; }
6983
- | VERBOSE { $$ = " verbose" ; }
6982
+ NonReservedWord { $$ = $1 ; }
6984
6983
;
6985
6984
6986
6985
explain_option_arg:
@@ -10776,7 +10775,7 @@ AexprConst: Iconst
10776
10775
10777
10776
Iconst: ICONST { $$ = $1 ; };
10778
10777
Sconst: SCONST { $$ = $1 ; };
10779
- RoleId: ColId { $$ = $1 ; };
10778
+ RoleId: NonReservedWord { $$ = $1 ; };
10780
10779
10781
10780
SignedIconst: Iconst { $$ = $1 ; }
10782
10781
| ' +' Iconst { $$ = + $2 ; }
@@ -10808,6 +10807,14 @@ type_function_name: IDENT { $$ = $1; }
10808
10807
| type_func_name_keyword { $$ = pstrdup ($1 ); }
10809
10808
;
10810
10809
10810
+ /* Any not-fully-reserved word --- these names can be, eg, role names.
10811
+ */
10812
+ NonReservedWord: IDENT { $$ = $1 ; }
10813
+ | unreserved_keyword { $$ = pstrdup ($1 ); }
10814
+ | col_name_keyword { $$ = pstrdup ($1 ); }
10815
+ | type_func_name_keyword { $$ = pstrdup ($1 ); }
10816
+ ;
10817
+
10811
10818
/* Column label --- allowed labels in "AS" clauses.
10812
10819
* This presently includes *all* Postgres keywords.
10813
10820
*/
0 commit comments