Repository navigation
feat: add on conflict do update where - #13155
Draft
aheuermann wants to merge 2 commits into
Draft
aheuermann wants to merge 2 commits into
aheuermann wants to merge 2 commits into
Conversation
revlucio
approved these changes
May 26, 2021
wbourne0
requested changes
Aug 4, 2021
Comment on lines
+2562
to
+2564
| if (options.updateOnDuplicate && options.where && dialect !== 'postgres') { | ||
| throw new Error(`${dialect} does not support the where clause option for bulkCreate.`); | ||
| } |
Member
There was a problem hiding this comment.
Both sqlite and postgres support this.
Also:
There's 2 clauses which might show up for both dialects in an ON CONFLICT DO UPDATE statement:
ON CONFLICT WHERE- This is used for indices, only references to the target table are allowed. E.g.ON CONFLICT WHERE "username"vsON CONFLICT WHERE "users"."username".ON CONFLICT DO UPDATE WHERE- This doesn't help with indices - however it allows for more advanced clause for when to update.
Member
There was a problem hiding this comment.
Oh nvm, its actually onConflictDoUpdateWhere not where. Might be worth simplifying this term, I'm using conflictWhere for the first WHERE - maybe updateWhere?
2 of 6 tasks
|
Can we re-evaluate if we can merge this in ? This is a very useful feature. |
on conflict do update where
aheuermann
requested review from
WikiRik and
ephys
and removed request for
a team
March 18, 2024 23:04
Contributor
|
Warning This pull request has been automatically converted to draft because it is not ready to be merged. Reason(s):
Once you have addressed the issue(s) above, you may |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closed #11656
Wanting some feedback on the API and can adjust. Mysql doesn't support a where clause for updates.
Pull Request check-list
Please make sure to review and check all of these items:
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
I'd like to be able to include a where clause in the a postgres upsert
INSERT ON CONFLICT DO UPDATEstatement. This is not currently possibly with sequelize. Something like: