Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ddl dml 切换执行报错 #182

Closed
kcxg opened this issue Mar 31, 2020 · 8 comments
Closed

ddl dml 切换执行报错 #182

kcxg opened this issue Mar 31, 2020 · 8 comments
Labels
wontfix This will not be worked on

Comments

@kcxg
Copy link

kcxg commented Mar 31, 2020

描述
执行完DDL 执行DML 然后再切换到ddl 会报错

重现
模拟重现的步骤
建表 插入语句 再建表时报错. no database selected

环境

  • 数据库: [mysql]
  • 版本: [5.7.17]

参数
可能与问题相关的设置参数

@kcxg
Copy link
Author

kcxg commented Mar 31, 2020

goincetion 版本 1.2.1

@hanchuanchuan
Copy link
Owner

请给出重现示例。

以下测试正常:
image

@kcxg
Copy link
Author

kcxg commented Apr 1, 2020

image

image

我先建表 再插入 然后再再建表时报错

@hanchuanchuan
Copy link
Owner

下述步骤经测试是成功的.

drop table if exists t1,t2;

create table t1(id int primary key,c1 int);

insert into t1 values(1,1),(2,2);

alter table t1 add column c2 int;

insert into t1 values(3,3,3);

drop table if exists t1,t2;

create table t2(id int primary key,c1 int);

insert into t2 values(3,3);

需要提供调用参数和SQL示例.

@kcxg
Copy link
Author

kcxg commented Apr 2, 2020

执行你发的上述sql 我的也是成功的

我的报错sql:
DROP TABLE IF EXISTS t1; CREATE TABLE t1 (idint(11) NOT NULL,c1int(11) DEFAULT NULL,c2 int(11) DEFAULT NULL, PRIMARY KEY (id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;

INSERT INTO t1 VALUES (1, 1, 1);

DROP TABLE IF EXISTS t2;
CREATE TABLE t2 (
id int(11) NOT NULL,
c1 int(11) DEFAULT NULL,
c2 int(11) DEFAULT NULL,
PRIMARY KEY (id) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic;`

image

我把insert 语句放在最后就不会报错啦

@hanchuanchuan
Copy link
Owner

开启事务导致的,后续会修复。 --trans=5000

hanchuanchuan added a commit that referenced this issue Apr 3, 2020
fix: 修复在事务中DDL和DML混合执行时可能出错的问题 (#182)
@hanchuanchuan
Copy link
Owner

该问题已修复. 更新最新版本即可.

@stale
Copy link

stale bot commented Apr 20, 2020

由于此问题没有最近的活动,因此已被自动标记为陈旧。如果没有进一步的活动,会作为不活跃issue关闭。感谢你对本项目的贡献。 This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Apr 20, 2020
@stale stale bot closed this as completed Apr 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants