summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2018-05-21 06:19:18 +0000
committerPavan Deolasee2018-05-21 06:19:18 +0000
commitc5b38d069356ea37255593ae36c02801fe83def9 (patch)
treec8a05f220326e09322102b0ac76d418eadc8b309
parente47a24a606356ba1fc7faf1560c696f4eb892388 (diff)
Add expected changes to plpgsql.out missed in 0f65a7193da4b6b0a35b6446b4c904a9f5ac9bf6
-rw-r--r--src/test/regress/expected/plpgsql.out34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/test/regress/expected/plpgsql.out b/src/test/regress/expected/plpgsql.out
index 9a05a05e3e..b03423e260 100644
--- a/src/test/regress/expected/plpgsql.out
+++ b/src/test/regress/expected/plpgsql.out
@@ -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)
+