.NET程序,使用v6.5.2版本数据库,在代码中添加事务后,使用临时表报错,相同代码,连接mysql8.0执行正常。
将跟踪到的sql拿到查询分析器中执行正常。
tidb日志:
[2024/03/29 11:20:19.803 +08:00] [INFO] [session.go:3764] [GENERAL_LOG] [conn=2937701555370986845] [user=root@192.168.135.1] [schemaVersion=10423] [txnStartTS=0] [forUpdateTS=0] [isReadConsistency=false] [currentDB=] [isPessimistic=false] [sessionTxnMode=PESSIMISTIC] [sql="use `tidb_test`"]
[2024/03/29 11:20:19.803 +08:00] [INFO] [session.go:3764] [GENERAL_LOG] [conn=2937701555370986845] [user=root@192.168.135.1] [schemaVersion=10423] [txnStartTS=0] [forUpdateTS=0] [isReadConsistency=false] [currentDB=tidb_test] [isPessimistic=false] [sessionTxnMode=PESSIMISTIC] [sql="SET NAMES utf8mb4;"]
[2024/03/29 11:20:19.803 +08:00] [INFO] [session.go:3764] [GENERAL_LOG] [conn=2937701555370986845] [user=root@192.168.135.1] [schemaVersion=10423] [txnStartTS=0] [forUpdateTS=0] [isReadConsistency=false] [currentDB=tidb_test] [isPessimistic=false] [sessionTxnMode=PESSIMISTIC] [sql="set session transaction isolation level repeatable read;"]
[2024/03/29 11:20:19.804 +08:00] [INFO] [session.go:3764] [GENERAL_LOG] [conn=2937701555370986845] [user=root@192.168.135.1] [schemaVersion=10423] [txnStartTS=0] [forUpdateTS=0] [isReadConsistency=false] [currentDB=tidb_test] [isPessimistic=false] [sessionTxnMode=PESSIMISTIC] [sql="start transaction;"]
[2024/03/29 11:20:23.043 +08:00] [INFO] [conn.go:1181] ["command dispatched failed"] [conn=2937701555370986845] [connInfo="id:2937701555370986845, addr:192.168.135.1:57074 status:11, collation:utf8mb4_general_ci, user:root"] [command=Query] [status="inTxn:1, autocommit:1"] [sql="
CREATE TEMPORARY TABLE tmp_customer_base(c_no varchar(20), PRIMARY KEY (c_no));
INSERT IGNORE INTO tmp_customer_base(c_no) values('11');
"] [txn_mode=PESSIMISTIC] [timestamp=448707276245827608] [err="[schema:1146]Table 'tidb_test.tmp_customer_base' doesn't exist"]
[2024/03/29 11:20:23.138 +08:00] [INFO] [session.go:3764] [GENERAL_LOG] [conn=2937701555370986845] [user=root@192.168.135.1] [schemaVersion=10423] [txnStartTS=448707276245827608] [forUpdateTS=448707276245827608] [isReadConsistency=false] [currentDB=tidb_test] [isPessimistic=true] [sessionTxnMode=PESSIMISTIC] [sql=rollback]
按日志组合sql执行,正常不报错。
USE `tidb_test`;
SET NAMES utf8mb4;
set session transaction isolation level repeatable read;
START TRANSACTION;
CREATE TEMPORARY TABLE tmp_customer_base(
c_no varchar(20),
PRIMARY KEY (c_no)
);
INSERT IGNORE INTO tmp_customer_base(c_no) values('11');