@ -642,6 +642,21 @@ decl_aliasitem : T_WORD
parser_errposition(@1)));
$$ = nsi;
}
| unreserved_keyword
{
PLpgSQL_nsitem *nsi;
nsi = plpgsql_ns_lookup(plpgsql_ns_top(), false,
$1, NULL, NULL,
NULL);
if (nsi == NULL)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("variable \"%s\" does not exist",
$1),
parser_errposition(@1)));
$$ = nsi;
}
| T_CWORD
{
PLpgSQL_nsitem *nsi;
@ -722,6 +737,11 @@ decl_collate :
$$ = get_collation_oid(list_make1(makeString($2.ident)),
false);
}
| K_COLLATE unreserved_keyword
{
$$ = get_collation_oid(list_make1(makeString(pstrdup($2))),
false);
}
| K_COLLATE T_CWORD
{
$$ = get_collation_oid($2.idents, false);
@ -1720,9 +1740,12 @@ stmt_raise : K_RAISE
}
else
{
if (tok != T_WORD)
yyerror("syntax error");
if (tok == T_WORD)
new->condname = yylval.word.ident;
else if (plpgsql_token_is_unreserved_keyword(tok))
new->condname = pstrdup(yylval.keyword);
else
yyerror("syntax error");
plpgsql_recognize_err_condition(new->condname,
false);
}
@ -2185,12 +2208,16 @@ opt_exitcond : ';'
;
/*
* need both options because scanner will have tried to resolve as variable
* need to allow DATUM because scanner will have tried to resolve as variable
*/
any_identifier : T_WORD
{
$$ = $1.ident;
}
| unreserved_keyword
{
$$ = pstrdup($1);
}
| T_DATUM
{
if ($1.ident == NULL) /* composite name not OK */
@ -2513,6 +2540,30 @@ read_datatype(int tok)
}
}
}
else if (plpgsql_token_is_unreserved_keyword(tok))
{
char *dtname = pstrdup(yylval.keyword);
tok = yylex();
if (tok == '%')
{
tok = yylex();
if (tok_is_keyword(tok, &yylval,
K_TYPE, "type"))
{
result = plpgsql_parse_wordtype(dtname);
if (result)
return result;
}
else if (tok_is_keyword(tok, &yylval,
K_ROWTYPE, "rowtype"))
{
result = plpgsql_parse_wordrowtype(dtname);
if (result)
return result;
}
}
}
else if (tok == T_CWORD)
{
List *dtnames = yylval.cword.idents;