Don't quote the output of format_procedure(); it's already quoted quite
enough. Remove the fn_name field, which was now just dead weight. Fix
remaining expected-output files.
PL/pgSQL function "test_variable_storage()" line 8 at PERFORM
PL/pgSQL function test_variable_storage() line 8 at PERFORM
test_variable_storage
-----------------------
123456789012
@ -2397,7 +2397,7 @@ end $$ language plpgsql;
select namedparmcursor_test7();
ERROR: division by zero
CONTEXT: SQL statement "SELECT 42/0 AS p1, 77 AS p2;"
PL/pgSQL function "namedparmcursor_test7()" line 6 at OPEN
PL/pgSQL function namedparmcursor_test7() line 6 at OPEN
-- check that line comments work correctly within the argument list (there
-- is some special handling of this case in the code: the newline after the
-- comment must be preserved when the argument-evaluating query is
@ -2431,7 +2431,7 @@ end;
$$ language plpgsql;
select raise_test1(5);
ERROR: too many parameters specified for RAISE
CONTEXT: PL/pgSQL function "raise_test1(integer)" line 3 at RAISE
CONTEXT: PL/pgSQL function raise_test1(integer) line 3 at RAISE
create function raise_test2(int) returns int as $$
begin
raise notice 'This message has too few parameters: %, %, %', $1, $1;
@ -2440,7 +2440,7 @@ end;
$$ language plpgsql;
select raise_test2(10);
ERROR: too few parameters specified for RAISE
CONTEXT: PL/pgSQL function "raise_test2(integer)" line 3 at RAISE
CONTEXT: PL/pgSQL function raise_test2(integer) line 3 at RAISE
-- Test re-RAISE inside a nested exception block. This case is allowed
-- by Oracle's PL/SQL but was handled differently by PG before 9.1.
CREATE FUNCTION reraise_test() RETURNS void AS $$
@ -2530,7 +2530,7 @@ begin
end;$$ language plpgsql;
select missing_return_expr();
ERROR: control reached end of function without RETURN
CONTEXT: PL/pgSQL function "missing_return_expr()"
CONTEXT: PL/pgSQL function missing_return_expr()
drop function void_return_expr();
drop function missing_return_expr();
--
@ -2582,7 +2582,7 @@ ERROR: column "sqlstate" does not exist
LINE 1: SELECT sqlstate
^
QUERY: SELECT sqlstate
CONTEXT: PL/pgSQL function "excpt_test1()" line 3 at RAISE
CONTEXT: PL/pgSQL function excpt_test1() line 3 at RAISE
create function excpt_test2() returns void as $$
begin
begin
@ -2597,7 +2597,7 @@ ERROR: column "sqlstate" does not exist
LINE 1: SELECT sqlstate
^
QUERY: SELECT sqlstate
CONTEXT: PL/pgSQL function "excpt_test2()" line 5 at RAISE
CONTEXT: PL/pgSQL function excpt_test2() line 5 at RAISE
create function excpt_test3() returns void as $$
begin
begin
@ -2803,7 +2803,7 @@ $$ language plpgsql;
-- should fail
select continue_test2();
ERROR: CONTINUE cannot be used outside a loop
CONTEXT: PL/pgSQL function "continue_test2()"
CONTEXT: PL/pgSQL function continue_test2()
-- CONTINUE can't reference the label of a named block
create function continue_test3() returns void as $$
begin
@ -2818,7 +2818,7 @@ $$ language plpgsql;
-- should fail
select continue_test3();
ERROR: CONTINUE cannot be used outside a loop
CONTEXT: PL/pgSQL function "continue_test3()"
CONTEXT: PL/pgSQL function continue_test3()
drop function continue_test1();
drop function continue_test2();
drop function continue_test3();
@ -2979,7 +2979,7 @@ begin
end$$ language plpgsql;
select footest();
ERROR: query returned more than one row
CONTEXT: PL/pgSQL function "footest()" line 5 at SQL statement
CONTEXT: PL/pgSQL function footest() line 5 at SQL statement
create or replace function footest() returns void as $$
declare x record;
begin
@ -3042,7 +3042,7 @@ begin
end$$ language plpgsql;
select footest();
ERROR: query returned no rows
CONTEXT: PL/pgSQL function "footest()" line 5 at SQL statement
CONTEXT: PL/pgSQL function footest() line 5 at SQL statement
create or replace function footest() returns void as $$
declare x record;
begin
@ -3052,7 +3052,7 @@ begin
end$$ language plpgsql;
select footest();
ERROR: query returned more than one row
CONTEXT: PL/pgSQL function "footest()" line 5 at SQL statement
CONTEXT: PL/pgSQL function footest() line 5 at SQL statement
create or replace function footest() returns void as $$
declare x record;
begin
@ -3076,7 +3076,7 @@ begin
end$$ language plpgsql;
select footest();
ERROR: query returned no rows
CONTEXT: PL/pgSQL function "footest()" line 5 at EXECUTE statement
CONTEXT: PL/pgSQL function footest() line 5 at EXECUTE statement
create or replace function footest() returns void as $$
declare x record;
begin
@ -3086,7 +3086,7 @@ begin
end$$ language plpgsql;
select footest();
ERROR: query returned more than one row
CONTEXT: PL/pgSQL function "footest()" line 5 at EXECUTE statement
CONTEXT: PL/pgSQL function footest() line 5 at EXECUTE statement
drop function footest();
-- test scrollable cursor support
create function sc_test() returns setof integer as $$
@ -3130,7 +3130,7 @@ $$ language plpgsql;
select * from sc_test(); -- fails because of NO SCROLL specification
ERROR: cursor can only scan forward
HINT: Declare it with SCROLL option to enable backward scan.
CONTEXT: PL/pgSQL function "sc_test()" line 7 at FETCH
CONTEXT: PL/pgSQL function sc_test() line 7 at FETCH
create or replace function sc_test() returns setof integer as $$
declare
c refcursor;
@ -3717,7 +3717,7 @@ end;
$$ language plpgsql;
select raise_test();
ERROR: RAISE option already specified: MESSAGE
CONTEXT: PL/pgSQL function "raise_test()" line 3 at RAISE
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
-- conflict on errcode
create or replace function raise_test() returns void as $$
begin
@ -3726,7 +3726,7 @@ end;
$$ language plpgsql;
select raise_test();
ERROR: RAISE option already specified: ERRCODE
CONTEXT: PL/pgSQL function "raise_test()" line 3 at RAISE
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
-- nothing to re-RAISE
create or replace function raise_test() returns void as $$
begin
@ -3735,7 +3735,7 @@ end;
$$ language plpgsql;
select raise_test();
ERROR: RAISE without parameters cannot be used outside an exception handler
CONTEXT: PL/pgSQL function "raise_test()" line 3 at RAISE
CONTEXT: PL/pgSQL function raise_test() line 3 at RAISE
-- test access to exception data
create function zero_divide() returns int as $$
declare v int := 0;
@ -3766,7 +3766,7 @@ exception when others then
end;
$$ language plpgsql;
select stacked_diagnostics_test();
NOTICE: sqlstate: 22012, message: division by zero, context: [PL/pgSQL function "zero_divide()" line 4 at RETURN <- SQL statement "SELECT zero_divide()" <- PL/pgSQL function "stacked_diagnostics_test()" line 6 at PERFORM]
NOTICE: sqlstate: 22012, message: division by zero, context: [PL/pgSQL function zero_divide() line 4 at RETURN <- SQL statement "SELECT zero_divide()" <- PL/pgSQL function stacked_diagnostics_test() line 6 at PERFORM]
stacked_diagnostics_test
--------------------------
@ -3808,7 +3808,7 @@ end;
$$ language plpgsql;
select stacked_diagnostics_test();
ERROR: GET STACKED DIAGNOSTICS cannot be used outside an exception handler
CONTEXT: PL/pgSQL function "stacked_diagnostics_test()" line 6 at GET DIAGNOSTICS
CONTEXT: PL/pgSQL function stacked_diagnostics_test() line 6 at GET DIAGNOSTICS
drop function zero_divide();
drop function stacked_diagnostics_test();
-- check cases where implicit SQLSTATE variable could be confused with
@ -3872,7 +3872,7 @@ select case_test(4);
select case_test(5); -- fails
ERROR: case not found
HINT: CASE statement is missing ELSE part.
CONTEXT: PL/pgSQL function "case_test(bigint)" line 5 at CASE
CONTEXT: PL/pgSQL function case_test(bigint) line 5 at CASE
select case_test(8);
case_test
----------------------
@ -3900,7 +3900,7 @@ select case_test(12);
select case_test(13); -- fails
ERROR: case not found
HINT: CASE statement is missing ELSE part.
CONTEXT: PL/pgSQL function "case_test(bigint)" line 5 at CASE
CONTEXT: PL/pgSQL function case_test(bigint) line 5 at CASE
create or replace function catch() returns void as $$
begin
raise notice '%', case_test(6);
@ -4228,7 +4228,7 @@ SAVEPOINT a;
select error2('nonexistent.stuffs');
ERROR: schema "nonexistent" does not exist
CONTEXT: SQL function "error1" statement 1
PL/pgSQL function "error2(text)" line 3 at RETURN
PL/pgSQL function error2(text) line 3 at RETURN
ROLLBACK TO a;
select error2('public.stuffs');
error2
@ -4266,7 +4266,7 @@ LINE 1: SELECT 'foo\\bar\041baz'
^
HINT: Use the escape string syntax for backslashes, e.g., E'\\'.
QUERY: SELECT 'foo\\bar\041baz'
CONTEXT: PL/pgSQL function "strtest()" line 4 at RETURN
CONTEXT: PL/pgSQL function strtest() line 4 at RETURN
strtest
-------------
foo\bar!baz
@ -4349,7 +4349,7 @@ ERROR: column "foo" does not exist
LINE 1: SELECT rtrim(roomno) AS roomno, foo FROM Room ORDER BY roomn...
^
QUERY: SELECT rtrim(roomno) AS roomno, foo FROM Room ORDER BY roomno
CONTEXT: PL/pgSQL function "inline_code_block" line 4 at FOR over SELECT rows
CONTEXT: PL/pgSQL function inline_code_block line 4 at FOR over SELECT rows
-- Check variable scoping -- a var is not available in its own or prior
-- default expressions.
create function scope_test() returns int as $$
@ -4386,7 +4386,7 @@ LINE 1: select q1,q2 from int8_tbl
^
DETAIL: It could refer to either a PL/pgSQL variable or a table column.
QUERY: select q1,q2 from int8_tbl
CONTEXT: PL/pgSQL function "conflict_test()" line 5 at FOR over SELECT rows
CONTEXT: PL/pgSQL function conflict_test() line 5 at FOR over SELECT rows
create or replace function conflict_test() returns setof int8_tbl as $$
#variable_conflict use_variable
declare r record;
@ -4490,10 +4490,10 @@ $$ language plpgsql;
-- should fail
select foreach_test(ARRAY[1,2,3,4]);
ERROR: FOREACH ... SLICE loop variable must be of an array type
CONTEXT: PL/pgSQL function "foreach_test(anyarray)" line 4 at FOREACH over array
CONTEXT: PL/pgSQL function foreach_test(anyarray) line 4 at FOREACH over array
select foreach_test(ARRAY[[1,2],[3,4]]);
ERROR: FOREACH ... SLICE loop variable must be of an array type
CONTEXT: PL/pgSQL function "foreach_test(anyarray)" line 4 at FOREACH over array
CONTEXT: PL/pgSQL function foreach_test(anyarray) line 4 at FOREACH over array
create or replace function foreach_test(anyarray)
returns void as $$
declare x int[];
@ -4533,7 +4533,7 @@ $$ language plpgsql;
-- should fail
select foreach_test(ARRAY[1,2,3,4]);
ERROR: slice dimension (2) is out of the valid range 0..1
CONTEXT: PL/pgSQL function "foreach_test(anyarray)" line 4 at FOREACH over array
CONTEXT: PL/pgSQL function foreach_test(anyarray) line 4 at FOREACH over array
-- ok
select foreach_test(ARRAY[[1,2],[3,4]]);
NOTICE: {{1,2},{3,4}}
@ -4694,9 +4694,9 @@ select testoa(1,2,3); -- try again to exercise internal caching
select testoa(2,1,3); -- fail at initial assign
ERROR: value for domain orderedarray violates check constraint "sorted"
CONTEXT: PL/pgSQL function "testoa(integer,integer,integer)" line 4 at assignment
CONTEXT: PL/pgSQL function testoa(integer,integer,integer) line 4 at assignment
select testoa(1,2,1); -- fail at update
ERROR: value for domain orderedarray violates check constraint "sorted"
CONTEXT: PL/pgSQL function "testoa(integer,integer,integer)" line 5 at assignment
CONTEXT: PL/pgSQL function testoa(integer,integer,integer) line 5 at assignment