当前位置:网站首页>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
边栏推荐
- The use method of quota command is expanded in detail, and the carrying method of quota command in RHEL 7! Disk capacity quota!
- Differences between nvisual generic cabling management software and network management software
- rust中的静态分发和动态分发
- Leetcode skimming: dynamic programming 05 (different paths II)
- Food safety eating preserved eggs will lead poisoning? Don't worry about eating after knowing these points
- Three things programmers want to do most | comics
- rust求两数之和
- Interviewer: how to use redis to realize distributed locks?
- 工作常用操作
- Tapdata 与优炫数据库完成产品兼容性互认证
猜你喜欢

爱可可AI前沿推介(7.23)

MySQL大量写入问题优化方案 MySQL参数调优

rust中的静态分发和动态分发

Interviewer: how to use redis to realize distributed locks?
![[flask advanced] deeply understand the endpoint of flask routing from the source code](/img/b9/b8dd5bb8aaa1fa5580a7048b2d6ef1.png)
[flask advanced] deeply understand the endpoint of flask routing from the source code

Time series data in industrial Internet of things

Console calculator developed based on C language

活动报名:如何零基础快速上手开源的 Tapdata Live Data Platform?

5秒到1秒,记一次效果“非常”显著的性能优化
A series of specifications of oneplus 10t were disclosed before the product was released
随机推荐
Time series data in industrial Internet of things
el-input使用
基于C语言开发的控制台计算器
xlinx pcie xvc
PDO操作
WSUS can patch MySQL Middleware_ Join the WSUS patch server and download the patch
程序员最想干的三件事 |漫画
5秒到1秒,记一次效果“非常”显著的性能优化
别再问我MySQL为啥没走索引?就这几种原因,全都告诉你
From 5 seconds to 1 second, remember the performance optimization with "very" significant effect once
Visual computer room management
转账业务追加日志(事务的传播行为).
Research and implementation of network multi exit design based on policy routing deployment
File management system based on OpenPGP
从马尔可夫链到GPT,字节跳动AI Lab总监李航细说语言模型的前世今生
数智化时代文旅遇新机?中国移动咪咕造 “元宇宙第一岛”
sns_ sensor_ instance_ api
Unity production QR code scanning
单细胞论文记录(part19)--A comprehensive comparison on cell-type composition inference for ST data
JS tool CECP