MySQL / MariaDB 不回滚事务
MySQL / MariaDB does not rollback transaction
我正在尝试进行事务然后回滚。
我的代码如下:
SET autocommit = OFF;
START TRANSACTION;
DROP TABLE IF EXISTS Test;
CREATE TABLE Test (test INT);
ROLLBACK;
然而,即使我调用 ROLLBACK
,table Test
仍将被创建。
table 使用 InnoDB。我正在使用 MariaDB 版本 10.3.15。
https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html
... The CREATE TABLE statement in InnoDB is processed as a single transaction. This means that a ROLLBACK from the user does not undo CREATE TABLE statements the user made during that transaction.
我正在尝试进行事务然后回滚。
我的代码如下:
SET autocommit = OFF;
START TRANSACTION;
DROP TABLE IF EXISTS Test;
CREATE TABLE Test (test INT);
ROLLBACK;
然而,即使我调用 ROLLBACK
,table Test
仍将被创建。
table 使用 InnoDB。我正在使用 MariaDB 版本 10.3.15。
https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html
... The CREATE TABLE statement in InnoDB is processed as a single transaction. This means that a ROLLBACK from the user does not undo CREATE TABLE statements the user made during that transaction.