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 09:15:43 +0000 (14:45 +0530)
src/test/regress/expected/plpgsql.out

index b8b2f7bf8f33b5499877cae08b4b2286964a83d7..a12d4cdf70626f3f618e975aa3c3462cfbde3a6e 100644 (file)
@@ -6045,3 +6045,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)
+