Avoid naming conflict between transactions.sql and namespace.sql.
Commits 681d9e462 et al added a test case in namespace.sql that implicitly relied on there not being a table "public.abc". However, the concurrently-run transactions.sql test creates precisely such a table, so with the right timing you'd get a failure. Creating a table named as generically as "abc" in a common schema seems like bad practice, so fix this by changing the name of transactions.sql's table. (Compare 2cf8c7aa4.) Marina Polyakova Discussion: https://postgr.es/m/80d0201636665d82185942e7112257b4@postgrespro.ru
This commit is contained in:
parent
803b4a26ca
commit
b973f93b6c
@ -609,10 +609,10 @@ drop function inverse(int);
|
|||||||
-- performed in the aborted subtransaction
|
-- performed in the aborted subtransaction
|
||||||
begin;
|
begin;
|
||||||
savepoint x;
|
savepoint x;
|
||||||
create table abc (a int);
|
create table trans_abc (a int);
|
||||||
insert into abc values (5);
|
insert into trans_abc values (5);
|
||||||
insert into abc values (10);
|
insert into trans_abc values (10);
|
||||||
declare foo cursor for select * from abc;
|
declare foo cursor for select * from trans_abc;
|
||||||
fetch from foo;
|
fetch from foo;
|
||||||
a
|
a
|
||||||
---
|
---
|
||||||
@ -625,11 +625,11 @@ fetch from foo;
|
|||||||
ERROR: cursor "foo" does not exist
|
ERROR: cursor "foo" does not exist
|
||||||
commit;
|
commit;
|
||||||
begin;
|
begin;
|
||||||
create table abc (a int);
|
create table trans_abc (a int);
|
||||||
insert into abc values (5);
|
insert into trans_abc values (5);
|
||||||
insert into abc values (10);
|
insert into trans_abc values (10);
|
||||||
insert into abc values (15);
|
insert into trans_abc values (15);
|
||||||
declare foo cursor for select * from abc;
|
declare foo cursor for select * from trans_abc;
|
||||||
fetch from foo;
|
fetch from foo;
|
||||||
a
|
a
|
||||||
---
|
---
|
||||||
@ -698,7 +698,7 @@ COMMIT;
|
|||||||
DROP FUNCTION create_temp_tab();
|
DROP FUNCTION create_temp_tab();
|
||||||
DROP FUNCTION invert(x float8);
|
DROP FUNCTION invert(x float8);
|
||||||
-- Tests for AND CHAIN
|
-- Tests for AND CHAIN
|
||||||
CREATE TABLE abc (a int);
|
CREATE TABLE trans_abc (a int);
|
||||||
-- set nondefault value so we have something to override below
|
-- set nondefault value so we have something to override below
|
||||||
SET default_transaction_read_only = on;
|
SET default_transaction_read_only = on;
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
||||||
@ -720,8 +720,8 @@ SHOW transaction_deferrable;
|
|||||||
on
|
on
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
INSERT INTO abc VALUES (1);
|
INSERT INTO trans_abc VALUES (1);
|
||||||
INSERT INTO abc VALUES (2);
|
INSERT INTO trans_abc VALUES (2);
|
||||||
COMMIT AND CHAIN; -- TBLOCK_END
|
COMMIT AND CHAIN; -- TBLOCK_END
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
transaction_isolation
|
transaction_isolation
|
||||||
@ -741,11 +741,11 @@ SHOW transaction_deferrable;
|
|||||||
on
|
on
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
INSERT INTO abc VALUES ('error');
|
INSERT INTO trans_abc VALUES ('error');
|
||||||
ERROR: invalid input syntax for type integer: "error"
|
ERROR: invalid input syntax for type integer: "error"
|
||||||
LINE 1: INSERT INTO abc VALUES ('error');
|
LINE 1: INSERT INTO trans_abc VALUES ('error');
|
||||||
^
|
^
|
||||||
INSERT INTO abc VALUES (3); -- check it's really aborted
|
INSERT INTO trans_abc VALUES (3); -- check it's really aborted
|
||||||
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
ERROR: current transaction is aborted, commands ignored until end of transaction block
|
||||||
COMMIT AND CHAIN; -- TBLOCK_ABORT_END
|
COMMIT AND CHAIN; -- TBLOCK_ABORT_END
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
@ -766,7 +766,7 @@ SHOW transaction_deferrable;
|
|||||||
on
|
on
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
INSERT INTO abc VALUES (4);
|
INSERT INTO trans_abc VALUES (4);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
@ -788,10 +788,10 @@ SHOW transaction_deferrable;
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SAVEPOINT x;
|
SAVEPOINT x;
|
||||||
INSERT INTO abc VALUES ('error');
|
INSERT INTO trans_abc VALUES ('error');
|
||||||
ERROR: invalid input syntax for type integer: "error"
|
ERROR: invalid input syntax for type integer: "error"
|
||||||
LINE 1: INSERT INTO abc VALUES ('error');
|
LINE 1: INSERT INTO trans_abc VALUES ('error');
|
||||||
^
|
^
|
||||||
COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING
|
COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
transaction_isolation
|
transaction_isolation
|
||||||
@ -811,7 +811,7 @@ SHOW transaction_deferrable;
|
|||||||
on
|
on
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
INSERT INTO abc VALUES (5);
|
INSERT INTO trans_abc VALUES (5);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
@ -873,7 +873,7 @@ SHOW transaction_deferrable;
|
|||||||
off
|
off
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
INSERT INTO abc VALUES (6);
|
INSERT INTO trans_abc VALUES (6);
|
||||||
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING
|
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
transaction_isolation
|
transaction_isolation
|
||||||
@ -893,10 +893,10 @@ SHOW transaction_deferrable;
|
|||||||
off
|
off
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
INSERT INTO abc VALUES ('error');
|
INSERT INTO trans_abc VALUES ('error');
|
||||||
ERROR: invalid input syntax for type integer: "error"
|
ERROR: invalid input syntax for type integer: "error"
|
||||||
LINE 1: INSERT INTO abc VALUES ('error');
|
LINE 1: INSERT INTO trans_abc VALUES ('error');
|
||||||
^
|
^
|
||||||
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END
|
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
transaction_isolation
|
transaction_isolation
|
||||||
@ -922,7 +922,7 @@ COMMIT AND CHAIN; -- error
|
|||||||
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
|
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
|
||||||
ROLLBACK AND CHAIN; -- error
|
ROLLBACK AND CHAIN; -- error
|
||||||
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
|
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
|
||||||
SELECT * FROM abc ORDER BY 1;
|
SELECT * FROM trans_abc ORDER BY 1;
|
||||||
a
|
a
|
||||||
---
|
---
|
||||||
1
|
1
|
||||||
@ -932,7 +932,7 @@ SELECT * FROM abc ORDER BY 1;
|
|||||||
(4 rows)
|
(4 rows)
|
||||||
|
|
||||||
RESET default_transaction_read_only;
|
RESET default_transaction_read_only;
|
||||||
DROP TABLE abc;
|
DROP TABLE trans_abc;
|
||||||
-- Test assorted behaviors around the implicit transaction block created
|
-- Test assorted behaviors around the implicit transaction block created
|
||||||
-- when multiple SQL commands are sent in a single Query message. These
|
-- when multiple SQL commands are sent in a single Query message. These
|
||||||
-- tests rely on the fact that psql will not break SQL commands apart at a
|
-- tests rely on the fact that psql will not break SQL commands apart at a
|
||||||
@ -1090,21 +1090,21 @@ SHOW transaction_read_only;
|
|||||||
off
|
off
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
CREATE TABLE abc (a int);
|
CREATE TABLE trans_abc (a int);
|
||||||
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
|
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
|
||||||
INSERT INTO abc VALUES (7)\; COMMIT\; INSERT INTO abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
|
INSERT INTO trans_abc VALUES (7)\; COMMIT\; INSERT INTO trans_abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
|
||||||
WARNING: there is no transaction in progress
|
WARNING: there is no transaction in progress
|
||||||
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
|
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
|
||||||
INSERT INTO abc VALUES (9)\; ROLLBACK\; INSERT INTO abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
|
INSERT INTO trans_abc VALUES (9)\; ROLLBACK\; INSERT INTO trans_abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
|
||||||
WARNING: there is no transaction in progress
|
WARNING: there is no transaction in progress
|
||||||
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
|
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
|
||||||
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
|
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
|
||||||
INSERT INTO abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
|
INSERT INTO trans_abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO trans_abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
|
||||||
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
|
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
|
||||||
INSERT INTO abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
|
INSERT INTO trans_abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO trans_abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
|
||||||
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
|
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
|
||||||
-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN
|
-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
|
||||||
SHOW transaction_isolation; -- transaction is active at this point
|
SHOW transaction_isolation; -- transaction is active at this point
|
||||||
transaction_isolation
|
transaction_isolation
|
||||||
-----------------------
|
-----------------------
|
||||||
@ -1112,7 +1112,7 @@ SHOW transaction_isolation; -- transaction is active at this point
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
|
||||||
SHOW transaction_isolation; -- transaction is active at this point
|
SHOW transaction_isolation; -- transaction is active at this point
|
||||||
transaction_isolation
|
transaction_isolation
|
||||||
-----------------------
|
-----------------------
|
||||||
@ -1122,7 +1122,7 @@ SHOW transaction_isolation; -- transaction is active at this point
|
|||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
SET default_transaction_isolation = 'read committed';
|
SET default_transaction_isolation = 'read committed';
|
||||||
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
|
-- 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
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (17)\; COMMIT\; INSERT INTO trans_abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
|
||||||
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
|
ERROR: COMMIT AND CHAIN can only be used in transaction blocks
|
||||||
SHOW transaction_isolation; -- out of transaction block
|
SHOW transaction_isolation; -- out of transaction block
|
||||||
transaction_isolation
|
transaction_isolation
|
||||||
@ -1130,7 +1130,7 @@ SHOW transaction_isolation; -- out of transaction block
|
|||||||
read committed
|
read committed
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (19)\; ROLLBACK\; INSERT INTO abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (19)\; ROLLBACK\; INSERT INTO trans_abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
|
||||||
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
|
ERROR: ROLLBACK AND CHAIN can only be used in transaction blocks
|
||||||
SHOW transaction_isolation; -- out of transaction block
|
SHOW transaction_isolation; -- out of transaction block
|
||||||
transaction_isolation
|
transaction_isolation
|
||||||
@ -1139,7 +1139,7 @@ SHOW transaction_isolation; -- out of transaction block
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
RESET default_transaction_isolation;
|
RESET default_transaction_isolation;
|
||||||
SELECT * FROM abc ORDER BY 1;
|
SELECT * FROM trans_abc ORDER BY 1;
|
||||||
a
|
a
|
||||||
----
|
----
|
||||||
7
|
7
|
||||||
@ -1147,7 +1147,7 @@ SELECT * FROM abc ORDER BY 1;
|
|||||||
17
|
17
|
||||||
(3 rows)
|
(3 rows)
|
||||||
|
|
||||||
DROP TABLE abc;
|
DROP TABLE trans_abc;
|
||||||
-- Test for successful cleanup of an aborted transaction at session exit.
|
-- Test for successful cleanup of an aborted transaction at session exit.
|
||||||
-- THIS MUST BE THE LAST TEST IN THIS FILE.
|
-- THIS MUST BE THE LAST TEST IN THIS FILE.
|
||||||
begin;
|
begin;
|
||||||
|
@ -378,10 +378,10 @@ drop function inverse(int);
|
|||||||
begin;
|
begin;
|
||||||
|
|
||||||
savepoint x;
|
savepoint x;
|
||||||
create table abc (a int);
|
create table trans_abc (a int);
|
||||||
insert into abc values (5);
|
insert into trans_abc values (5);
|
||||||
insert into abc values (10);
|
insert into trans_abc values (10);
|
||||||
declare foo cursor for select * from abc;
|
declare foo cursor for select * from trans_abc;
|
||||||
fetch from foo;
|
fetch from foo;
|
||||||
rollback to x;
|
rollback to x;
|
||||||
|
|
||||||
@ -391,11 +391,11 @@ commit;
|
|||||||
|
|
||||||
begin;
|
begin;
|
||||||
|
|
||||||
create table abc (a int);
|
create table trans_abc (a int);
|
||||||
insert into abc values (5);
|
insert into trans_abc values (5);
|
||||||
insert into abc values (10);
|
insert into trans_abc values (10);
|
||||||
insert into abc values (15);
|
insert into trans_abc values (15);
|
||||||
declare foo cursor for select * from abc;
|
declare foo cursor for select * from trans_abc;
|
||||||
|
|
||||||
fetch from foo;
|
fetch from foo;
|
||||||
|
|
||||||
@ -441,7 +441,7 @@ DROP FUNCTION invert(x float8);
|
|||||||
|
|
||||||
-- Tests for AND CHAIN
|
-- Tests for AND CHAIN
|
||||||
|
|
||||||
CREATE TABLE abc (a int);
|
CREATE TABLE trans_abc (a int);
|
||||||
|
|
||||||
-- set nondefault value so we have something to override below
|
-- set nondefault value so we have something to override below
|
||||||
SET default_transaction_read_only = on;
|
SET default_transaction_read_only = on;
|
||||||
@ -450,19 +450,19 @@ START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
|||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
SHOW transaction_read_only;
|
SHOW transaction_read_only;
|
||||||
SHOW transaction_deferrable;
|
SHOW transaction_deferrable;
|
||||||
INSERT INTO abc VALUES (1);
|
INSERT INTO trans_abc VALUES (1);
|
||||||
INSERT INTO abc VALUES (2);
|
INSERT INTO trans_abc VALUES (2);
|
||||||
COMMIT AND CHAIN; -- TBLOCK_END
|
COMMIT AND CHAIN; -- TBLOCK_END
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
SHOW transaction_read_only;
|
SHOW transaction_read_only;
|
||||||
SHOW transaction_deferrable;
|
SHOW transaction_deferrable;
|
||||||
INSERT INTO abc VALUES ('error');
|
INSERT INTO trans_abc VALUES ('error');
|
||||||
INSERT INTO abc VALUES (3); -- check it's really aborted
|
INSERT INTO trans_abc VALUES (3); -- check it's really aborted
|
||||||
COMMIT AND CHAIN; -- TBLOCK_ABORT_END
|
COMMIT AND CHAIN; -- TBLOCK_ABORT_END
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
SHOW transaction_read_only;
|
SHOW transaction_read_only;
|
||||||
SHOW transaction_deferrable;
|
SHOW transaction_deferrable;
|
||||||
INSERT INTO abc VALUES (4);
|
INSERT INTO trans_abc VALUES (4);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
||||||
@ -470,12 +470,12 @@ SHOW transaction_isolation;
|
|||||||
SHOW transaction_read_only;
|
SHOW transaction_read_only;
|
||||||
SHOW transaction_deferrable;
|
SHOW transaction_deferrable;
|
||||||
SAVEPOINT x;
|
SAVEPOINT x;
|
||||||
INSERT INTO abc VALUES ('error');
|
INSERT INTO trans_abc VALUES ('error');
|
||||||
COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING
|
COMMIT AND CHAIN; -- TBLOCK_ABORT_PENDING
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
SHOW transaction_read_only;
|
SHOW transaction_read_only;
|
||||||
SHOW transaction_deferrable;
|
SHOW transaction_deferrable;
|
||||||
INSERT INTO abc VALUES (5);
|
INSERT INTO trans_abc VALUES (5);
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE, DEFERRABLE;
|
||||||
@ -494,12 +494,12 @@ START TRANSACTION ISOLATION LEVEL SERIALIZABLE, READ WRITE, NOT DEFERRABLE;
|
|||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
SHOW transaction_read_only;
|
SHOW transaction_read_only;
|
||||||
SHOW transaction_deferrable;
|
SHOW transaction_deferrable;
|
||||||
INSERT INTO abc VALUES (6);
|
INSERT INTO trans_abc VALUES (6);
|
||||||
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING
|
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_PENDING
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
SHOW transaction_read_only;
|
SHOW transaction_read_only;
|
||||||
SHOW transaction_deferrable;
|
SHOW transaction_deferrable;
|
||||||
INSERT INTO abc VALUES ('error');
|
INSERT INTO trans_abc VALUES ('error');
|
||||||
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END
|
ROLLBACK AND CHAIN; -- TBLOCK_ABORT_END
|
||||||
SHOW transaction_isolation;
|
SHOW transaction_isolation;
|
||||||
SHOW transaction_read_only;
|
SHOW transaction_read_only;
|
||||||
@ -510,11 +510,11 @@ ROLLBACK;
|
|||||||
COMMIT AND CHAIN; -- error
|
COMMIT AND CHAIN; -- error
|
||||||
ROLLBACK AND CHAIN; -- error
|
ROLLBACK AND CHAIN; -- error
|
||||||
|
|
||||||
SELECT * FROM abc ORDER BY 1;
|
SELECT * FROM trans_abc ORDER BY 1;
|
||||||
|
|
||||||
RESET default_transaction_read_only;
|
RESET default_transaction_read_only;
|
||||||
|
|
||||||
DROP TABLE abc;
|
DROP TABLE trans_abc;
|
||||||
|
|
||||||
|
|
||||||
-- Test assorted behaviors around the implicit transaction block created
|
-- Test assorted behaviors around the implicit transaction block created
|
||||||
@ -579,39 +579,39 @@ SHOW transaction_read_only;
|
|||||||
SET TRANSACTION READ ONLY\; ROLLBACK AND CHAIN; -- error
|
SET TRANSACTION READ ONLY\; ROLLBACK AND CHAIN; -- error
|
||||||
SHOW transaction_read_only;
|
SHOW transaction_read_only;
|
||||||
|
|
||||||
CREATE TABLE abc (a int);
|
CREATE TABLE trans_abc (a int);
|
||||||
|
|
||||||
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
|
-- COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
|
||||||
INSERT INTO abc VALUES (7)\; COMMIT\; INSERT INTO abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
|
INSERT INTO trans_abc VALUES (7)\; COMMIT\; INSERT INTO trans_abc VALUES (8)\; COMMIT AND CHAIN; -- 7 commit, 8 error
|
||||||
INSERT INTO abc VALUES (9)\; ROLLBACK\; INSERT INTO abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
|
INSERT INTO trans_abc VALUES (9)\; ROLLBACK\; INSERT INTO trans_abc VALUES (10)\; ROLLBACK AND CHAIN; -- 9 rollback, 10 error
|
||||||
|
|
||||||
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
|
-- COMMIT/ROLLBACK AND CHAIN + COMMIT/ROLLBACK
|
||||||
INSERT INTO abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
|
INSERT INTO trans_abc VALUES (11)\; COMMIT AND CHAIN\; INSERT INTO trans_abc VALUES (12)\; COMMIT; -- 11 error, 12 not reached
|
||||||
INSERT INTO abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
|
INSERT INTO trans_abc VALUES (13)\; ROLLBACK AND CHAIN\; INSERT INTO trans_abc VALUES (14)\; ROLLBACK; -- 13 error, 14 not reached
|
||||||
|
|
||||||
-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN
|
-- START TRANSACTION + COMMIT/ROLLBACK AND CHAIN
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (15)\; COMMIT AND CHAIN; -- 15 ok
|
||||||
SHOW transaction_isolation; -- transaction is active at this point
|
SHOW transaction_isolation; -- transaction is active at this point
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (16)\; ROLLBACK AND CHAIN; -- 16 ok
|
||||||
SHOW transaction_isolation; -- transaction is active at this point
|
SHOW transaction_isolation; -- transaction is active at this point
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
|
|
||||||
SET default_transaction_isolation = 'read committed';
|
SET default_transaction_isolation = 'read committed';
|
||||||
|
|
||||||
-- START TRANSACTION + COMMIT/ROLLBACK + COMMIT/ROLLBACK AND CHAIN
|
-- 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
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (17)\; COMMIT\; INSERT INTO trans_abc VALUES (18)\; COMMIT AND CHAIN; -- 17 commit, 18 error
|
||||||
SHOW transaction_isolation; -- out of transaction block
|
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
|
START TRANSACTION ISOLATION LEVEL REPEATABLE READ\; INSERT INTO trans_abc VALUES (19)\; ROLLBACK\; INSERT INTO trans_abc VALUES (20)\; ROLLBACK AND CHAIN; -- 19 rollback, 20 error
|
||||||
SHOW transaction_isolation; -- out of transaction block
|
SHOW transaction_isolation; -- out of transaction block
|
||||||
|
|
||||||
RESET default_transaction_isolation;
|
RESET default_transaction_isolation;
|
||||||
|
|
||||||
SELECT * FROM abc ORDER BY 1;
|
SELECT * FROM trans_abc ORDER BY 1;
|
||||||
|
|
||||||
DROP TABLE abc;
|
DROP TABLE trans_abc;
|
||||||
|
|
||||||
|
|
||||||
-- Test for successful cleanup of an aborted transaction at session exit.
|
-- Test for successful cleanup of an aborted transaction at session exit.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user