Fix thinko in tok_is_keyword(): it was looking at the wrong union variant

of YYSTYPE, and hence returning the wrong answer for cases where a plpgsql
"unreserved keyword" really does conflict with a variable name.  Obviously
I didn't test this enough :-(.  Per bug #5524 from Peter Gagarinov.
This commit is contained in:
Tom Lane
2010-06-25 16:40:13 +00:00
parent 3bdd23932b
commit 399da7d882
3 changed files with 31 additions and 3 deletions

View File

@ -2916,6 +2916,20 @@ $$ language plpgsql;
select raise_test();
-- check cases where implicit SQLSTATE variable could be confused with
-- SQLSTATE as a keyword, cf bug #5524
create or replace function raise_test() returns void as $$
begin
perform 1/0;
exception
when sqlstate '22012' then
raise notice using message = sqlstate;
raise sqlstate '22012' using message = 'substitute message';
end;
$$ language plpgsql;
select raise_test();
drop function raise_test();
-- test CASE statement