diff options
author | Thomas Munro <tmunro@postgresql.org> | 2021-03-17 17:13:43 +1300 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2021-03-17 17:26:20 +1300 |
commit | 37929599499fe5760a9dbab48a10a898879a0d44 (patch) | |
tree | f50f86e86784b378ab5ce87b58053ed1c5b0c154 /src | |
parent | 6b67d72b604cb913e39324b81b61ab194d94cba0 (diff) | |
download | postgresql-37929599499fe5760a9dbab48a10a898879a0d44.tar.gz postgresql-37929599499fe5760a9dbab48a10a898879a0d44.zip |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/test/regress/expected/transactions.out | 2 | ||||
-rw-r--r-- | src/test/regress/sql/transactions.sql | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/test/regress/expected/transactions.out b/src/test/regress/expected/transactions.out index 75dc6558d82..61862d595d1 100644 --- a/src/test/regress/expected/transactions.out +++ b/src/test/regress/expected/transactions.out @@ -1026,6 +1026,7 @@ SHOW transaction_isolation; -- transaction is active at this point (1 row) ROLLBACK; +SET default_transaction_isolation = 'read committed'; -- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (17)\; COMMIT\; INSERT INTO abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error ERROR: COMMIT AND CHAIN can only be used in transaction blocks @@ -1043,6 +1044,7 @@ SHOW transaction_isolation; -- out of transaction block read committed (1 row) +RESET default_transaction_isolation; SELECT * FROM abc ORDER BY 1; a ---- diff --git a/src/test/regress/sql/transactions.sql b/src/test/regress/sql/transactions.sql index d1b6ed0280d..8886280c0a6 100644 --- a/src/test/regress/sql/transactions.sql +++ b/src/test/regress/sql/transactions.sql @@ -578,6 +578,8 @@ START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (16)\ SHOW transaction_isolation; -- transaction is active at this point ROLLBACK; +SET default_transaction_isolation = 'read committed'; + -- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (17)\; COMMIT\; INSERT INTO abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error SHOW transaction_isolation; -- out of transaction block @@ -585,6 +587,8 @@ SHOW transaction_isolation; -- out of transaction block START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (19)\; ROLLBACK\; INSERT INTO abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error SHOW transaction_isolation; -- out of transaction block +RESET default_transaction_isolation; + SELECT * FROM abc ORDER BY 1; DROP TABLE abc; |