Skip to content
Discussion options

You must be logged in to vote

@maticzav because of the number of nested queries we can support in an upsert, Prisma does a few checks when an upsert happens. We have improved our docs around upserts. Take a look here https://www.prisma.io/docs/reference/api-reference/prisma-client-reference#unique-key-constraint-errors-on-upserts This should explain what is happening.

In your case, there is a race condition. Two Prisma operations first do a SELECT to see if a row with a and SLOVENIAN exists. Both operations do not see a row that exists. So both operations try to add the row. The first operation inserts the new row. The second operation tries to insert and fails on because the row now exists. In those cases, you catch …

Replies: 6 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@austincrim
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by maticzav
Comment options

You must be logged in to vote
1 reply
@garrensmith
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants