diff --git a/expected/plpgsql_check_active.out b/expected/plpgsql_check_active.out index 09927f5..bf05336 100644 --- a/expected/plpgsql_check_active.out +++ b/expected/plpgsql_check_active.out @@ -9219,3 +9219,41 @@ select * from plpgsql_check_function('fx()'); (0 rows) drop function fx(); +-- should not to raise warning +do $$ +declare + c cursor for select * from generate_series(1,10); + t int; +begin + for i in 1..2 + loop + open c; + loop + fetch c into t; + exit when not found; + raise notice '%', t; + end loop; + close c; + end loop; +end; +$$; +NOTICE: 1 +NOTICE: 2 +NOTICE: 3 +NOTICE: 4 +NOTICE: 5 +NOTICE: 6 +NOTICE: 7 +NOTICE: 8 +NOTICE: 9 +NOTICE: 10 +NOTICE: 1 +NOTICE: 2 +NOTICE: 3 +NOTICE: 4 +NOTICE: 5 +NOTICE: 6 +NOTICE: 7 +NOTICE: 8 +NOTICE: 9 +NOTICE: 10 diff --git a/expected/plpgsql_check_active_1.out b/expected/plpgsql_check_active_1.out index d0cfaca..bade33e 100644 --- a/expected/plpgsql_check_active_1.out +++ b/expected/plpgsql_check_active_1.out @@ -9222,3 +9222,41 @@ select * from plpgsql_check_function('fx()'); (0 rows) drop function fx(); +-- should not to raise warning +do $$ +declare + c cursor for select * from generate_series(1,10); + t int; +begin + for i in 1..2 + loop + open c; + loop + fetch c into t; + exit when not found; + raise notice '%', t; + end loop; + close c; + end loop; +end; +$$; +NOTICE: 1 +NOTICE: 2 +NOTICE: 3 +NOTICE: 4 +NOTICE: 5 +NOTICE: 6 +NOTICE: 7 +NOTICE: 8 +NOTICE: 9 +NOTICE: 10 +NOTICE: 1 +NOTICE: 2 +NOTICE: 3 +NOTICE: 4 +NOTICE: 5 +NOTICE: 6 +NOTICE: 7 +NOTICE: 8 +NOTICE: 9 +NOTICE: 10 diff --git a/sql/plpgsql_check_active.sql b/sql/plpgsql_check_active.sql index 9c6a854..d03ad1f 100644 --- a/sql/plpgsql_check_active.sql +++ b/sql/plpgsql_check_active.sql @@ -5469,3 +5469,22 @@ $$ language plpgsql; select * from plpgsql_check_function('fx()'); drop function fx(); + +-- should not to raise warning +do $$ +declare + c cursor for select * from generate_series(1,10); + t int; +begin + for i in 1..2 + loop + open c; + loop + fetch c into t; + exit when not found; + raise notice '%', t; + end loop; + close c; + end loop; +end; +$$;