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

gorm.DB.Clauses(clause.OnConflict{UpdateAll: true}) do not wok when using CreateInBatches #7190

Open
tuhaolam opened this issue Sep 5, 2024 · 1 comment
Assignees
Labels

Comments

@tuhaolam
Copy link

tuhaolam commented Sep 5, 2024

1、问题:
gorm.DB.Clauses(clause.OnConflict{UpdateAll: true})在执行CreateInBatches时不生效,反复出现同样的报错信息,并且更新失败,表存在唯一索引idx_ns_domain_path,由nsdomain_path字段构成:

2024-09-05 22:37:00.413	ERROR	demo/demo_nodes.go:215	Error 1062: Duplicate entry 'demotest-newApp4cat' for key 'idx_ns_domain_path'
2024-09-05 22:37:00.662	ERROR	demo/t_demo_demo_nodes.gen.go:50	failed to exec BatchInsertdemoNode: Error 1062: Duplicate entry 'demotest-newApp4cat' for key 'idx_ns_domain_path'
2024-09-05 22:37:00.662	ERROR	demo/demo_nodes.go:215	Error 1062: Duplicate entry 'demotest-newApp4cat' for key 'idx_ns_domain_path'
2024-09-05 22:37:00.896	ERROR	demo/t_demo_demo_nodes.gen.go:50	failed to exec BatchInsertdemoNode: Error 1062: Duplicate entry 'demotest-newApp4cat' for key 'idx_ns_domain_path'

2、环境

	gorm.io/driver/mysql v1.3.2
	gorm.io/gorm v1.25.8
@github-actions github-actions bot added the type:missing reproduction steps missing reproduction steps label Sep 5, 2024
Copy link

github-actions bot commented Sep 5, 2024

The issue has been automatically marked as stale as it missing playground pull request link, which is important to help others understand your issue effectively and make sure the issue hasn't been fixed on latest master, checkout https://github.com/go-gorm/playground for details. it will be closed in 30 days if no further activity occurs. if you are asking question, please use the Question template, most likely your question already answered https://github.com/go-gorm/gorm/issues or described in the document https://gorm.ioSearch Before Asking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants