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

Support for `insert or ignore` for Sqlite. #1303

Closed
alatiera opened this Issue Nov 14, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@alatiera
Contributor

alatiera commented Nov 14, 2017

Atm you kinda have to isolate the query and throw away the result in order to do that.

let _ = diesel::insert(foo)
    .into(atable)
    .execute(con);

It would be nice if you could do something like this:

diesel::insert_into(atable)
    .values(foo)
    .on_conflict()
    .do_nothing() 
    .execute(con)?;

Or even on_conflict().update() run replace_into instead?

I think this sort of functionality exists for Postgres with .on_conflict().do_nothing() but It would be nice if something like that existed for Sqlite too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment