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
Row update with DB Row Lock (SELECT FOR UPDATE) #1918
I kind of disagree with this closing this, row locking is important and one step in providing more control to dev since long running transactions are out of the question for now. That could allow chaining of a findOne and update where the update takes some data from the findOne.
Reacted by Mikhail Podgurskiy, qsona, Samuli Suomi, omid habibi, guAnsunyata, sibeliuz, Guillaume Simard, Bianca Bossé, Cody Joseph Krainock, Casey Chow and 21 more
@Sytten Then we need an issue about this set of problems. As this one was explicitly about what prisma/prisma-client-js#655 covers, it would be invalid to keep this around. We are happy to look into other problems that require this, and might even require this general solution.
There should be more generic solution to using SELECT .. FOR UPDATE to lock rows before an update. Atomic number operations don't quite cut it.
Reacted by jasperatcake, Zolo | Zolbayar Bayarsaikhan, Rok, Roman Gonzalez, Karel Osorio, Sebastian Sipos, Alireza Alami, Akeju, Ashish Bhattarai, Munyiri Karobia and 6 more
Activity
schickling commentedon Mar 24, 2020
We've already drafted a Client API improved for this use case in this issue:
This won't be implemented using a DB lock but by mapping to native atomic DB operations.
yovanoc commentedon Mar 29, 2020
Ohhh look very nice! Any timeline for a v1 of this draft?
steebchen commentedon Apr 23, 2020
related for number-like types: prisma/prisma-client-js#655
albertoperdomo commentedon Jul 8, 2020
Thanks for the feature request @flybayer!
As mentioned earlier in the issue, we are planning to tackle atomic operations natively in prisma/prisma-client-js#655.
If you still feel the need for acquiring DB row locks for other operations, please feel free to open a new feature request.
Sytten commentedon Jul 8, 2020
I kind of disagree with this closing this, row locking is important and one step in providing more control to dev since long running transactions are out of the question for now. That could allow chaining of a findOne and update where the update takes some data from the findOne.
janpio commentedon Jul 8, 2020
@Sytten Then we need an issue about this set of problems. As this one was explicitly about what prisma/prisma-client-js#655 covers, it would be invalid to keep this around. We are happy to look into other problems that require this, and might even require this general solution.
JoniBR commentedon Dec 7, 2022
Why was this closed? I don't see another solution providing this :(
janpio commentedon Dec 7, 2022
See #1918 (comment)
leppaott commentedon Apr 30, 2024
There should be more generic solution to using
SELECT .. FOR UPDATEto lock rows before an update. Atomic number operations don't quite cut it.