Skip to content

clause.OnConflict{DoNothing: true} using ON DUPLICATE KEY UPDATE id=id actually? #7559

@wi-cuckoo

Description

@wi-cuckoo

Your Question

my code is:

if err := getClientWithContext(ctx).
	Clauses(clause.OnConflict{DoNothing: true}).
	Create(relList).
	Error; err != nil {
	return fmt.Errorf("%w, insert relList failed", err)
}

I found the sql in gorm log is INSERT INTO ... ON DUPLICATE KEY UPDATE id=id.
Why clause.OnConflict{DoNothing: true} using ON DUPLICATE KEY UPDATE id=id actually?Not INSERT IGNORE

The document you expected this should be explained

Expected answer

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions