当前位置:网站首页>MySQL executes alter table XX add column with duplicate entry error
MySQL executes alter table XX add column with duplicate entry error
2022-07-23 17:46:00 【pilaf1990】
mysql The version is 5.7.25-28-log, The storage engine of the table is InnoDB.
The implementation is as follows DDL:
alter table mytable
add column ...( Some fields are omitted ),
add column price int NOT NULL DEFAULT '0' COMMENT ' Price ';
But reported an error
ERROR 1062 (23000): Duplicate entry '9277700--1' for key 'spu_sku'
Thu Sep 3 16:56:56 2020
This watch has UNIQUE KEY `spu_sku` (`spu`,`sku`), Will guarantee not to repeat , It shouldn't be Duplicate entry Error of ,
And when you query, you find that there is really only one record in the table spu yes 9277700,sku yes -1.
I checked the Internet and found that this is MySQL perform online DDL There will be problems . according to https://jira.mariadb.org/browse/MDEV-14535 The solution on this page .
perform DDL( added ALGORITHM=COPY):
alter table mytable
add column ...( Some fields are omitted ),
add column price int NOT NULL DEFAULT '0' COMMENT ' Price '
ALGORITHM=COPY;
solve the problem , No more misstatements .
Interested readers , You can refer to Mysql Official documents :
https://dev.mysql.com/doc/refman/5.7/en/innodb-online-ddl-limitations.html
边栏推荐
- Mysql操作
- Virtual machine network connection mode
- ride the wind and waves! Digital transformation in the era of financial technology
- Interviewer: how to use redis to realize distributed locks?
- [introduction series of redis] data types and related commands of redis
- The larger the convolution kernel, the stronger the performance? An interpretation of replknet model
- File management system based on OpenPGP
- 可视化机房管理
- Food safety | attention to smoking food, do you know this knowledge
- The use method of quota command is expanded in detail, and the carrying method of quota command in RHEL 7! Disk capacity quota!
猜你喜欢

isEmpty 和 isBlank 的用法区别,至少一半的人答不上来...

USB通信协议深入理解

ride the wind and waves! Digital transformation in the era of financial technology

作为一名后台开发人员,你必须知道的两种过滤器

File management system based on OpenPGP

Redis分布式锁,没它真不行

Thread pool, who am I? Where am I?

Deeply understand the mode and vibration of mechanical system

“如今,代码数已膨胀至天文级别”
Do you dare to use BigDecimal without mastering these pits?
随机推荐
你真的了解Redis的持久化机制吗?
New opportunities for cultural tourism in the era of digital intelligence? China Mobile Migu creates "the first island in the yuan universe"
Leetcode question brushing record
Redis数据丢失问题
Single cell thesis record (part19) -- a comprehensive comparison on cell type composition information for St data
nVisual综合布线管理软件与网管软件的区别
面试官:如何用 Redis 实现分布式锁?
为啥一问 JVM 就 懵B ???
面试官:MySQL 数据库查询慢,除了索引问题还可能是什么原因?
Don't ask me again why MySQL hasn't left the index? For these reasons, I'll tell you all
基于scrapy的电商平台数据爬取与展示
活动报名:如何零基础快速上手开源的 Tapdata Live Data Platform?
分布式事务解决方案
js工具 cecp
curl get&post
In depth understanding of USB communication protocol
Tapdata 与优炫数据库完成产品兼容性互认证
分析optimism重放合约地址攻击事件
Time series data in industrial Internet of things
[pytorch] basic use 7. GPU allocation