summaryrefslogtreecommitdiff
path: root/src/test/regress/sql/transactions.sql
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/regress/sql/transactions.sql')
-rw-r--r--src/test/regress/sql/transactions.sql32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/test/regress/sql/transactions.sql b/src/test/regress/sql/transactions.sql
index a656c393b4f..5af024fdfe6 100644
--- a/src/test/regress/sql/transactions.sql
+++ b/src/test/regress/sql/transactions.sql
@@ -96,6 +96,38 @@ COMMIT;
SELECT * FROM foo; -- should have 1 and 3
SELECT * FROM barbaz; -- should have 1
+-- check that starting a subxact in a failed xact or subxact works
+BEGIN;
+ SELECT 0/0; -- fail the outer xact
+ BEGIN;
+ SELECT 1; -- this should NOT work
+ COMMIT;
+ SELECT 1; -- this should NOT work
+ BEGIN;
+ SELECT 1; -- this should NOT work
+ ROLLBACK;
+ SELECT 1; -- this should NOT work
+COMMIT;
+SELECT 1; -- this should work
+
+BEGIN;
+ BEGIN;
+ SELECT 1; -- this should work
+ SELECT 0/0; -- fail the subxact
+ SELECT 1; -- this should NOT work
+ BEGIN;
+ SELECT 1; -- this should NOT work
+ ROLLBACK;
+ BEGIN;
+ SELECT 1; -- this should NOT work
+ COMMIT;
+ SELECT 1; -- this should NOT work
+ ROLLBACK;
+ SELECT 1; -- this should work
+COMMIT;
+SELECT 1; -- this should work
+
+
DROP TABLE foo;
DROP TABLE baz;
DROP TABLE barbaz;