Skip to content
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

Postgres ignore + replace #298

Merged
merged 5 commits into from
May 9, 2018
Merged

Postgres ignore + replace #298

merged 5 commits into from
May 9, 2018

Conversation

AllanWang
Copy link
Contributor

@AllanWang AllanWang commented May 3, 2018

Resolves #290

This PR attempts to add support for ignore and replace

From what I've looked up, ignore involves simply adding ON CONFLICT DO NOTHING.

Replace is a bit different for postgres, as it goes through ignore and calls update on conflicts. It also needs to specify which keys to look out for conflicts, which is why I've made it default to the unique keys (snippet taken from the H2 code).

This was tested against this code

The dependency is passed through jitpack, so it's easy to tweak something and update the import


On top of this, I have one question:

The replace method for PG looks similar to ignore from H2. Isn't ignore not supposed to update rows and just stop on conflict?

Once I have a better idea of what's going on I can document the arguments so it's clearer for people like me who are new to sql

AllanWang added 2 commits May 4, 2018 22:39
Make pg replace only use primary keys
@Tapac Tapac merged commit 2331213 into JetBrains:master May 9, 2018
Tapac added a commit that referenced this pull request May 9, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants