-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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 (mssql): bulkUpdate returning values #12410
Conversation
The CI fails on an |
You need to submit a fix to master branch before this can be merged |
#12413 was created as requested. |
@@ -393,7 +393,7 @@ class QueryGenerator { | |||
|
|||
suffix += selectFromTmp; | |||
} | |||
} else if (this._dialect.supports.returnValues && options.returning) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep this check, first check test if dialect supports returnings like MySQL which doesn't support it. Second if user is requesting to return records
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at line 367 - you won't even get into this if statement if this._dialect.supports.returnValues
was false. why recheck for it?
I didn't understand this, are you saying this change will improve performance? |
Yes. Consider this scenario: const [rowsUpdate, [updatedBook]] = Book.update(
{price: 100},
{returning: true, where: {price: 0} }
) Without this PR - |
- bulkUpdate will now return the updates if options.returning is true. - updateQuery removed duplicate setting check - Fix documentation for model.update
Reference for change is based on sequelize#12260 - use rowCount intead of data.length when not returning data
e6b2eaf
to
187297d
Compare
@sunshinewyin Added the new test to this branch as well as Look for Seems the test now fail on an unrelated issue |
🎉 This PR is included in version 5.22.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Pull Request check-list
Please make sure to review and check all of these items:
npm run test
ornpm run test-DIALECT
pass with this change (including linting)?Description of change
Fix MSSQL returning values for bulkUpdate
The issue creates a major performance hit for v5 - as bulkUpdates right now does not work correctly and requires to run another query to get the model data - which is returning already in the update itself.