I have a table using a composite primary key. When one of the primary key fields in a record in the database has a value of 0, after I modify this record and then use Save() to save the model, gorm is unable to correctly handle this as an UPDATE operation, but instead uses INSERT, leading to a Duplicate entry error.
I have a table using a composite primary key. When one of the primary key fields in a record in the database has a value of 0, after I modify this record and then use
Save()
to save the model, gorm is unable to correctly handle this as anUPDATE
operation, but instead usesINSERT
, leading to aDuplicate entry
error.