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

关于不规范操作导致一个比较极端的BUG #307

Closed
xiaozhute opened this issue Feb 23, 2021 · 3 comments
Closed

关于不规范操作导致一个比较极端的BUG #307

xiaozhute opened this issue Feb 23, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@xiaozhute
Copy link

描述
这是一个不规范的操作,但实际操作中确实有可能遇到
当创建表语句和删除字段语句同时存在,且针对的是同一个表操作时候,会报错;
分区表同理,创建分区和删除分区同一表时候,也会出现错误。

重现

## 创建表
CREATE TABLE `testpar` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
  `a` varchar(10) DEFAULT NULL COMMENT 'a',
  `buss_day` varchar(8) NOT NULL COMMENT 'day',
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_a` (`buss_day`,`a`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='分区表';

# 删除字段
alter table drop column a;

环境

  • 数据库: MySQL 5.7.27
  • goInception 版本:1.2.4.27

参数
enable_partition_table = true

@xiaozhute
Copy link
Author

补充下,这个也会导致有问题

这个业务场景在某些切换操作中可能会用到的

-- 创建表 t1
create table t1(id int primary key comment '主键',a varchar(10) comment 'aa',b datetime comment 'bb') comment '测试1';

-- 创建表 t2  和 t1同结构
create table t2 like t1;
rename table t1 to t1_old,t2 to t1;
 
-- 这里会报错,表 t1 不存在
insert into t1 values(1,1,null),(2,2,null);

@stale
Copy link

stale bot commented Mar 16, 2021

由于此问题没有最近的活动,因此已被自动标记为陈旧。如果没有进一步的活动,会作为不活跃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 Mar 16, 2021
@hanchuanchuan hanchuanchuan added the bug Something isn't working label Mar 24, 2021
@stale stale bot removed the wontfix This will not be worked on label Mar 24, 2021
hanchuanchuan added a commit that referenced this issue Mar 24, 2021
fix: 修复rename table语法一次修改多个表名时,有表名逻辑上不生效的问题 (#307)
@hanchuanchuan
Copy link
Owner

该问题已修复,原因是对rename table语法的审核逻辑有问题,在一次rename多个表时,仅会处理第一个表。

稍后可升级到v1.2.4-46及之后版本。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants