Skip to content

Commit

Permalink
fix regress tests 9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
okbob committed Oct 12, 2015
1 parent 4a36b5c commit 86c0344
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions expected/plpgsql_check_active-9.3.out
Expand Up @@ -292,3 +292,79 @@ select * from plpgsql_check_function('fx2()', performance_warnings := true);
(2 rows)

drop function fx2();
create or replace function test_lab()
returns void as $$
begin
<<outer>>
for a in 1..3 loop
<<sub>>
BEGIN
<<inner>>
for b in 8..9 loop
if a=2 then
continue sub;
end if;
raise notice '% %', a, b;
end loop inner;
END sub;
end loop outer;
end;
$$ language plpgsql;
select test_lab();
NOTICE: 1 8
NOTICE: 1 9
ERROR: CONTINUE cannot be used outside a loop
CONTEXT: PL/pgSQL function test_lab()
select * from plpgsql_check_function('test_lab()', performance_warnings := true);
plpgsql_check_function
----------------------------------------------------------------------
error:42601:10:CONTINUE:block label "sub" cannot be used in CONTINUE
(1 row)

create or replace function test_lab()
returns void as $$
begin
continue;
end;
$$ language plpgsql;
select test_lab();
ERROR: CONTINUE cannot be used outside a loop
CONTEXT: PL/pgSQL function test_lab()
select * from plpgsql_check_function('test_lab()', performance_warnings := true);
plpgsql_check_function
---------------------------------------------------------------
error:42601:3:CONTINUE:CONTINUE cannot be used outside a loop
(1 row)

create type _exception_type as (
state text,
message text,
detail text);
create or replace function f1()
returns void as $$
declare
_exception record;
begin
_exception := NULL::_exception_type;
exception when others then
get stacked diagnostics
_exception.state = RETURNED_SQLSTATE,
_exception.message = MESSAGE_TEXT,
_exception.detail = PG_EXCEPTION_DETAIL,
_exception.hint = PG_EXCEPTION_HINT;
end;
$$ language plpgsql;
select f1();
f1
----

(1 row)

select * from plpgsql_check_function('f1()');
plpgsql_check_function
-----------------------------------------------------------------------
error:42703:7:GET DIAGNOSTICS:record "_exception" has no field "hint"
(1 row)

drop function f1();
drop type _exception_type;

0 comments on commit 86c0344

Please sign in to comment.