You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, I wanna know if you inserted diff data with the same primary key, that will cause this error. And maybe you can check if there are any parallel issues.
Your Question
我在程序里大量使用了 db.Table('xxx').CreateInBatches(records, 100),但是在程序运行中有一个定时任务(1天1次)在插入数据时偶尔会出现
Error 1062 (23000): Duplicate entry '2606' for key 'xxx.PRIMARY' 这个错误提示。让我百思不得其解的是大量的 CreateInBatches 调用 ,之前仅有
这一个表在批量插入时会出现这个问题。因为技术原因排查不出问题前天就把无用的主键ID 删除掉了 ,然后昨天和今天另一个表开始出现了同样的问题。请问我应该如何做。MySQL 8.0.32 go 1.20 gorm.io/driver/mysql v1.5.7 gorm.io/gorm v1.25.12
The document you expected this should be explained
Expected answer
The text was updated successfully, but these errors were encountered: