diff options
| author | Tom Lane | 2010-06-25 16:40:13 +0000 |
|---|---|---|
| committer | Tom Lane | 2010-06-25 16:40:13 +0000 |
| commit | 399da7d882dff22b7ad926fb07aafeda2feab999 (patch) | |
| tree | 52ce13ba93e80836a85ad95b3eb161e48c98f4bc /src/test | |
| parent | 3bdd23932b2a1d0dcae5b10e639108c2430ca9f0 (diff) | |
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.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/plpgsql.out | 14 | ||||
| -rw-r--r-- | src/test/regress/sql/plpgsql.sql | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out index 619939ffa38..a22e2bfd0f1 100644 --- a/src/test/regress/expected/plpgsql.out +++ b/src/test/regress/expected/plpgsql.out @@ -3578,6 +3578,20 @@ $$ language plpgsql; select raise_test(); ERROR: RAISE without parameters cannot be used outside an exception handler CONTEXT: PL/pgSQL function "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(); +NOTICE: 22012 +ERROR: substitute message drop function raise_test(); -- test CASE statement create or replace function case_test(bigint) returns text as $$ diff --git a/src/test/regress/sql/plpgsql.sql b/src/test/regress/sql/plpgsql.sql index e181b10898e..612e92d21be 100644 --- a/src/test/regress/sql/plpgsql.sql +++ b/src/test/regress/sql/plpgsql.sql @@ -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 |
