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
{{ message }}
Repository navigation
MSSQL UniqueConstraintError does not match for primary keys #8973
Using model.findOrCreate on a table with a composite primary key will produce a generic database error because the unique key violation check does not check for primary key violations.
Model.findOrCreate(...)
What do you expect to happen?
findOrCreate should not produce a database error due to a unique key violation. It should requery and return an instance.
What is actually happening?
findOrCreate will produce the following error when inserting under high load:
SequelizeDatabaseError: Violation of PRIMARY KEY constraint '...'. Cannot insert duplicate key in object '...'. The duplicate key value is (..., ...)."
match = err.message.match(/Violation of (UNIQUE|PRIMARY) KEY constraint '((.|\s)*)'. Cannot insert duplicate key in object '.*'.(:? The duplicate key value is \((.*)\).)?/);
Activity