Skip to content

Commit 3792959

Browse files
committed
Fix transaction.sql tests in higher isolation levels.
It seems like a useful sanity check to be able to run "installcheck" against a cluster running with default_transaction_level set to serializable or repeatable read. Only one thing currently fails in those configurations, so let's fix that. No back-patch for now, because it fails in many other places in some of the stable branches. We'd have to go back and fix those too if we included this configuration in automated testing. Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Discussion: https://postgr.es/m/CA%2BhUKGJUaHeK%3DHLATxF1JOKDjKJVrBKA-zmbPAebOM0Se2FQRg%40mail.gmail.com
1 parent 6b67d72 commit 3792959

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/test/regress/expected/transactions.out

+2
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,7 @@ SHOW transaction_isolation; -- transaction is active at this point
10261026
(1 row)
10271027

10281028
ROLLBACK;
1029+
SET default_transaction_isolation = 'read committed';
10291030
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
10301031
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (17)\; COMMIT\; INSERT INTO abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
10311032
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
@@ -1043,6 +1044,7 @@ SHOW transaction_isolation; -- out of transaction block
10431044
read committed
10441045
(1 row)
10451046

1047+
RESET default_transaction_isolation;
10461048
SELECT * FROM abc ORDER BY 1;
10471049
a
10481050
----

src/test/regress/sql/transactions.sql

+4
Original file line numberDiff line numberDiff line change
@@ -578,13 +578,17 @@ START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (16)\
578578
SHOW transaction_isolation; -- transaction is active at this point
579579
ROLLBACK;
580580

581+
SET default_transaction_isolation = 'read committed';
582+
581583
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
582584
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (17)\; COMMIT\; INSERT INTO abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
583585
SHOW transaction_isolation; -- out of transaction block
584586

585587
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (19)\; ROLLBACK\; INSERT INTO abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
586588
SHOW transaction_isolation; -- out of transaction block
587589

590+
RESET default_transaction_isolation;
591+
588592
SELECT * FROM abc ORDER BY 1;
589593

590594
DROP TABLE abc;

0 commit comments

Comments
 (0)