summaryrefslogtreecommitdiff
path: root/src/test/regress/expected/portals.out
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-04-11 19:51:16 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-04-11 19:51:16 +0000
commitc3294f1cbfe02293b4a7c6b2e58ca4c09a7e541f (patch)
treed4d422b08f15bce2b32867ae3cc8e722e08e9df2 /src/test/regress/expected/portals.out
parent0c400f1bbc3231ed75e11d3ab0ec7a4a9d3c8486 (diff)
downloadpostgresql-c3294f1cbfe02293b4a7c6b2e58ca4c09a7e541f.tar.gz
Fix interaction between materializing holdable cursors and firing
deferred triggers: either one can create more work for the other, so we have to loop till it's all gone. Per example from andrew@supernews. Add a regression test to help spot trouble in this area in future.
Diffstat (limited to 'src/test/regress/expected/portals.out')
-rw-r--r--src/test/regress/expected/portals.out35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/test/regress/expected/portals.out b/src/test/regress/expected/portals.out
index a46a14ce80..3f0e0cdd26 100644
--- a/src/test/regress/expected/portals.out
+++ b/src/test/regress/expected/portals.out
@@ -773,3 +773,38 @@ FETCH ALL FROM c;
(15 rows)
ROLLBACK;
+--
+-- Test behavior of both volatile and stable functions inside a cursor;
+-- in particular we want to see what happens during commit of a holdable
+-- cursor
+--
+create temp table tt1(f1 int);
+create function count_tt1_v() returns int8 as
+'select count(*) from tt1' language sql volatile;
+create function count_tt1_s() returns int8 as
+'select count(*) from tt1' language sql stable;
+begin;
+insert into tt1 values(1);
+declare c1 cursor for select count_tt1_v(), count_tt1_s();
+insert into tt1 values(2);
+fetch all from c1;
+ count_tt1_v | count_tt1_s
+-------------+-------------
+ 2 | 1
+(1 row)
+
+rollback;
+begin;
+insert into tt1 values(1);
+declare c2 cursor with hold for select count_tt1_v(), count_tt1_s();
+insert into tt1 values(2);
+commit;
+delete from tt1;
+fetch all from c2;
+ count_tt1_v | count_tt1_s
+-------------+-------------
+ 2 | 1
+(1 row)
+
+drop function count_tt1_v();
+drop function count_tt1_s();