Add expected changes to plpgsql.out missed in 0f65a7193da4b6b0a35b6446b4c904a9f5ac9bf6
authorPavan Deolasee <[email protected]>
Mon, 21 May 2018 06:19:18 +0000 (11:49 +0530)
committerPavan Deolasee <[email protected]>
Mon, 21 May 2018 06:19:18 +0000 (11:49 +0530)
src/test/regress/expected/plpgsql.out

index 9a05a05e3e5227cd919a28f60acb9f58b8d163f4..b03423e260d5477bb1bdddf175cb1ee61e0e77e2 100644 (file)
@@ -6042,3 +6042,37 @@ SELECT * FROM list_partitioned_table() AS t;
  2
 (2 rows)
 
+-- ensure that all statements in a function are correctly executed in a
+-- transaction block.
+create table plp_mt_tab(a int, b int);
+create function plpgsql_multistmt() returns void as $$
+begin
+       insert into plp_mt_tab(a) values (1);
+       insert into plp_mt_tab(a) values (2);
+       insert into plp_mt_tab(a) values (3/0);
+end
+$$ language plpgsql;
+select plpgsql_multistmt();
+ERROR:  division by zero
+CONTEXT:  SQL statement "insert into plp_mt_tab(a) values (3/0)"
+PL/pgSQL function plpgsql_multistmt() line 5 at SQL statement
+select * from plp_mt_tab;
+ a | b 
+---+---
+(0 rows)
+
+create or replace function plpgsql_multistmt() returns void as $$
+begin
+       insert into plp_mt_tab(a) values (3);
+       update plp_mt_tab set b = 1 where (a / 0) = 0;
+end
+$$ language plpgsql;
+select plpgsql_multistmt();
+ERROR:  division by zero
+CONTEXT:  SQL statement "update plp_mt_tab set b = 1 where (a / 0) = 0"
+PL/pgSQL function plpgsql_multistmt() line 4 at SQL statement
+select * from plp_mt_tab;
+ a | b 
+---+---
+(0 rows)
+