mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +03:00
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:
@ -571,10 +571,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
|
||||||
---
|
---
|
||||||
@ -587,11 +587,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
|
||||||
---
|
---
|
||||||
@ -660,7 +660,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;
|
||||||
@ -682,8 +682,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
|
||||||
@ -703,11 +703,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;
|
||||||
@ -728,7 +728,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;
|
||||||
@ -750,10 +750,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
|
||||||
@ -773,7 +773,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;
|
||||||
@ -835,7 +835,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
|
||||||
@ -855,10 +855,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
|
||||||
@ -884,7 +884,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
|
||||||
@ -894,7 +894,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
|
||||||
@ -996,21 +996,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
|
||||||
-----------------------
|
-----------------------
|
||||||
@ -1018,7 +1018,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
|
||||||
-----------------------
|
-----------------------
|
||||||
@ -1027,7 +1027,7 @@ SHOW transaction_isolation; -- transaction is active at this point
|
|||||||
|
|
||||||
ROLLBACK;
|
ROLLBACK;
|
||||||
-- 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
|
||||||
@ -1035,7 +1035,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
|
||||||
@ -1043,7 +1043,7 @@ SHOW transaction_isolation; -- out of transaction block
|
|||||||
read committed
|
read committed
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT * FROM abc ORDER BY 1;
|
SELECT * FROM trans_abc ORDER BY 1;
|
||||||
a
|
a
|
||||||
----
|
----
|
||||||
7
|
7
|
||||||
@ -1051,7 +1051,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;
|
||||||
|
@ -358,10 +358,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;
|
||||||
|
|
||||||
@ -371,11 +371,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;
|
||||||
|
|
||||||
@ -421,7 +421,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;
|
||||||
@ -430,19 +430,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;
|
||||||
@ -450,12 +450,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;
|
||||||
@ -474,12 +474,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;
|
||||||
@ -490,11 +490,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
|
||||||
@ -559,35 +559,35 @@ 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;
|
||||||
|
|
||||||
-- 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
|
||||||
|
|
||||||
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.
|
||||||
|
Reference in New Issue
Block a user