-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add WITH (lock) clause for MSSQL select with join queries #8507
fix: add WITH (lock) clause for MSSQL select with join queries #8507
Conversation
88f10b4
to
4d6d19f
Compare
typeorm didn't supported LOCK clause in SELECT + JOIN query. For example, we cannot buld SQL such as "SELECT * FROM USER U WITH(NOLOCK) INNER JOIN ORDER WITH(NOLOCK) O ON U.ID=O.UserID". This pull request enables LOCK with SELECT + JOIN sql query. Closes: typeorm#4764
4d6d19f
to
893af06
Compare
a62ec08
to
5607bdd
Compare
Any plans on when to merge this? I think this would solve a lot of my problems! |
Looks like a breaking change? What is the difference between locks being set on |
I think this pull request only effects on MSSQL Driver. In summary, In MSSQL, although we set
|
For your question, this link is relevant to answer. https://stackoverflow.com/questions/3783525/sql-server-nolock-and-joins |
Any updates on this pull request ? |
thank you for contribution! |
Typeorm didn't supported LOCK clause in MSSQL SELECT + JOIN query.
For example, when we write code with typeorm like this
we would expect the corresponding SQL of this statement is
but typeorm generates SQL like this
This pull request enables LOCK with SELECT + JOIN sql query.
This pull request will prevent deadlock situations while querying SELECT statements during transactions. (in case of MSSQL Driver)
Closes: #4764
Description of change
Pull-Request Checklist
master
branchnpm run lint
passes with this changenpm run test
passes with this changeFixes #0000
(N/A)
Documentation has been updated to reflect this change