-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Upsert code fails with composite unique key #5351
Copy link
Copy link
Closed
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type
Description
(Maybe related to #4776)
Upserts work correctly when there are unique indexes for only one value not with composite unique keys.
I defined in sequelize : (in an option of orm.define)
indexes:[
{
type: "unique",
fields: ['PartId', 'code'],
name: "StEvt_partCode"
}
The operation fails with :
ERROR: duplicate key value violates unique constraint "StEvt_partCode"
DETAIL: Key ("PartId", code)=(1, 0) already exists.
CONTEXT: SQL statement "UPDATE "StatusEvts" SET "PartId"=1,"code"=0,"msg"='Normal'"
PL/pgSQL function pg_temp_2.sequelize_upsert() line 1 at SQL statement
And the composite unique key is not explained in a where option of the UPDATE part of the query.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type: bugDEPRECATED: replace with the "bug" issue typeDEPRECATED: replace with the "bug" issue type