pingcap / tidb

TiDB is an open-source, cloud-native, distributed, MySQL-Compatible database for elastic scale and real-time analytics. Try AI-powered Chat2Query free at : https://www.pingcap.com/tidb-serverless/

Home Page:https://pingcap.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CREATE TABLE didn't rollback when using transaction;

Nickelth opened this issue · comments

Bug Report

Please answer these questions before submitting your issue. Thanks!
I want to make sure two tables both be created successfully, if one failes, rollback the whole transaction, but I found that transaction won't rollback CREATE TABLE statements.

1. Minimal reproduce step (Required)

start transaction;
create table t0(c0 int);
rollback;
select * from t0;

2. What did you expect to see? (Required)

> start transaction;
Query OK, 0 rows affected (0.00 sec)
> create table t0(c0 int);
Query OK, 0 rows affected (0.16 sec)
> rollback;
Query OK, 0 rows affected (0.00 sec)
> select * from t0;
ERROR 1146 (42S02): Table 'd0.t0' doesn't exist

3. What did you see instead (Required)

> start transaction;
Query OK, 0 rows affected (0.00 sec)
> create table t0(c0 int);
Query OK, 0 rows affected (0.16 sec)
> rollback;
Query OK, 0 rows affected (0.00 sec)
> select * from t0;
Empty set (0.01 sec)

4. What is your TiDB version? (Required)

Release Version: v8.2.0-alpha-94-g81a7cf5548-dirty
Edition: Community
Git Commit Hash: 81a7cf55486310670667c7e9892815f2d32d65fb
Git Branch: master
UTC Build Time: 2024-05-08 14:31:25
GoVersion: go1.21.7
Race Enabled: false
Check Table Before Drop: false
Store: tikv

this should be the same behaviour as MySQL https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html