@@ -425,9 +425,10 @@ static void processCASbits(int cas_bits, int location, const char *constrType,
425
425
426
426
%type <ival> Iconst SignedIconst
427
427
%type <str> Sconst comment_text notify_payload
428
- %type <str> RoleId opt_granted_by opt_boolean_or_string ColId_or_Sconst
428
+ %type <str> RoleId opt_granted_by opt_boolean_or_string
429
429
%type <list> var_list
430
430
%type <str> ColId ColLabel var_name type_function_name param_name
431
+ %type <str> NonReservedWord NonReservedWord_or_Sconst
431
432
%type <node> var_value zone_value
432
433
433
434
%type <keyword> unreserved_keyword type_func_name_keyword
@@ -1324,15 +1325,15 @@ set_rest_more: /* Generic SET syntaxes: */
1324
1325
n->kind = VAR_SET_DEFAULT;
1325
1326
$$ = n;
1326
1327
}
1327
- | ROLE ColId_or_Sconst
1328
+ | ROLE NonReservedWord_or_Sconst
1328
1329
{
1329
1330
VariableSetStmt *n = makeNode(VariableSetStmt);
1330
1331
n->kind = VAR_SET_VALUE;
1331
1332
n->name = " role" ;
1332
1333
n->args = list_make1(makeStringConst($2 , @2 ));
1333
1334
$$ = n;
1334
1335
}
1335
- | SESSION AUTHORIZATION ColId_or_Sconst
1336
+ | SESSION AUTHORIZATION NonReservedWord_or_Sconst
1336
1337
{
1337
1338
VariableSetStmt *n = makeNode(VariableSetStmt);
1338
1339
n->kind = VAR_SET_VALUE;
@@ -1395,11 +1396,11 @@ opt_boolean_or_string:
1395
1396
| FALSE_P { $$ = " false" ; }
1396
1397
| ON { $$ = " on" ; }
1397
1398
/*
1398
- * OFF is also accepted as a boolean value, but is handled
1399
- * by the ColId rule below. The action for booleans and strings
1399
+ * OFF is also accepted as a boolean value, but is handled by
1400
+ * the NonReservedWord rule. The action for booleans and strings
1400
1401
* is the same, so we don't need to distinguish them here.
1401
1402
*/
1402
- | ColId_or_Sconst { $$ = $1 ; }
1403
+ | NonReservedWord_or_Sconst { $$ = $1 ; }
1403
1404
;
1404
1405
1405
1406
/* Timezone values can be:
@@ -1468,8 +1469,8 @@ opt_encoding:
1468
1469
| /* EMPTY*/ { $$ = NULL ; }
1469
1470
;
1470
1471
1471
- ColId_or_Sconst :
1472
- ColId { $$ = $1 ; }
1472
+ NonReservedWord_or_Sconst :
1473
+ NonReservedWord { $$ = $1 ; }
1473
1474
| Sconst { $$ = $1 ; }
1474
1475
;
1475
1476
@@ -3234,7 +3235,7 @@ NumericOnly_list: NumericOnly { $$ = list_make1($1); }
3234
3235
*****************************************************************************/
3235
3236
3236
3237
CreatePLangStmt :
3237
- CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
3238
+ CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE NonReservedWord_or_Sconst
3238
3239
{
3239
3240
CreatePLangStmt *n = makeNode(CreatePLangStmt);
3240
3241
n->replace = $2 ;
@@ -3246,7 +3247,7 @@ CreatePLangStmt:
3246
3247
n->pltrusted = false ;
3247
3248
$$ = (Node *)n;
3248
3249
}
3249
- | CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE ColId_or_Sconst
3250
+ | CREATE opt_or_replace opt_trusted opt_procedural LANGUAGE NonReservedWord_or_Sconst
3250
3251
HANDLER handler_name opt_inline_handler opt_validator
3251
3252
{
3252
3253
CreatePLangStmt *n = makeNode(CreatePLangStmt);
@@ -3290,7 +3291,7 @@ opt_validator:
3290
3291
;
3291
3292
3292
3293
DropPLangStmt :
3293
- DROP opt_procedural LANGUAGE ColId_or_Sconst opt_drop_behavior
3294
+ DROP opt_procedural LANGUAGE NonReservedWord_or_Sconst opt_drop_behavior
3294
3295
{
3295
3296
DropStmt *n = makeNode(DropStmt);
3296
3297
n->removeType = OBJECT_LANGUAGE;
@@ -3301,7 +3302,7 @@ DropPLangStmt:
3301
3302
n->concurrent = false ;
3302
3303
$$ = (Node *)n;
3303
3304
}
3304
- | DROP opt_procedural LANGUAGE IF_P EXISTS ColId_or_Sconst opt_drop_behavior
3305
+ | DROP opt_procedural LANGUAGE IF_P EXISTS NonReservedWord_or_Sconst opt_drop_behavior
3305
3306
{
3306
3307
DropStmt *n = makeNode(DropStmt);
3307
3308
n->removeType = OBJECT_LANGUAGE;
@@ -3403,11 +3404,11 @@ create_extension_opt_item:
3403
3404
{
3404
3405
$$ = makeDefElem(" schema" , (Node *)makeString($2 ));
3405
3406
}
3406
- | VERSION_P ColId_or_Sconst
3407
+ | VERSION_P NonReservedWord_or_Sconst
3407
3408
{
3408
3409
$$ = makeDefElem(" new_version" , (Node *)makeString($2 ));
3409
3410
}
3410
- | FROM ColId_or_Sconst
3411
+ | FROM NonReservedWord_or_Sconst
3411
3412
{
3412
3413
$$ = makeDefElem(" old_version" , (Node *)makeString($2 ));
3413
3414
}
@@ -3436,7 +3437,7 @@ alter_extension_opt_list:
3436
3437
;
3437
3438
3438
3439
alter_extension_opt_item :
3439
- TO ColId_or_Sconst
3440
+ TO NonReservedWord_or_Sconst
3440
3441
{
3441
3442
$$ = makeDefElem(" new_version" , (Node *)makeString($2 ));
3442
3443
}
@@ -5189,8 +5190,8 @@ SecLabelStmt:
5189
5190
}
5190
5191
;
5191
5192
5192
- opt_provider : FOR ColId_or_Sconst { $$ = $2 ; }
5193
- | /* empty */ { $$ = NULL ; }
5193
+ opt_provider : FOR NonReservedWord_or_Sconst { $$ = $2 ; }
5194
+ | /* empty */ { $$ = NULL ; }
5194
5195
;
5195
5196
5196
5197
security_label_type :
@@ -6214,7 +6215,7 @@ createfunc_opt_item:
6214
6215
{
6215
6216
$$ = makeDefElem(" as" , (Node *)$2 );
6216
6217
}
6217
- | LANGUAGE ColId_or_Sconst
6218
+ | LANGUAGE NonReservedWord_or_Sconst
6218
6219
{
6219
6220
$$ = makeDefElem(" language" , (Node *)makeString($2 ));
6220
6221
}
@@ -6429,7 +6430,7 @@ dostmt_opt_item:
6429
6430
{
6430
6431
$$ = makeDefElem(" as" , (Node *)makeString($1 ));
6431
6432
}
6432
- | LANGUAGE ColId_or_Sconst
6433
+ | LANGUAGE NonReservedWord_or_Sconst
6433
6434
{
6434
6435
$$ = makeDefElem(" language" , (Node *)makeString($2 ));
6435
6436
}
@@ -8314,9 +8315,7 @@ explain_option_elem:
8314
8315
;
8315
8316
8316
8317
explain_option_name :
8317
- ColId { $$ = $1 ; }
8318
- | analyze_keyword { $$ = " analyze" ; }
8319
- | VERBOSE { $$ = " verbose" ; }
8318
+ NonReservedWord { $$ = $1 ; }
8320
8319
;
8321
8320
8322
8321
explain_option_arg :
@@ -12197,7 +12196,7 @@ AexprConst: Iconst
12197
12196
12198
12197
Iconst: ICONST { $$ = $1 ; };
12199
12198
Sconst: SCONST { $$ = $1 ; };
12200
- RoleId: ColId { $$ = $1 ; };
12199
+ RoleId: NonReservedWord { $$ = $1 ; };
12201
12200
12202
12201
SignedIconst: Iconst { $$ = $1 ; }
12203
12202
| ' +' Iconst { $$ = + $2 ; }
@@ -12229,6 +12228,14 @@ type_function_name: IDENT { $$ = $1; }
12229
12228
| type_func_name_keyword { $$ = pstrdup ($1 ); }
12230
12229
;
12231
12230
12231
+ /* Any not-fully-reserved word --- these names can be, eg, role names.
12232
+ */
12233
+ NonReservedWord: IDENT { $$ = $1 ; }
12234
+ | unreserved_keyword { $$ = pstrdup ($1 ); }
12235
+ | col_name_keyword { $$ = pstrdup ($1 ); }
12236
+ | type_func_name_keyword { $$ = pstrdup ($1 ); }
12237
+ ;
12238
+
12232
12239
/* Column label --- allowed labels in "AS" clauses.
12233
12240
* This presently includes *all* Postgres keywords.
12234
12241
*/
0 commit comments