diesel-rs/diesel

SupportsReturningClause mysql

Open

#2535 opened on Oct 9, 2020

View on GitHub
 (16 comments) (9 reactions) (1 assignee)Rust (12,054 stars) (1,003 forks)batch import
documentationhelp wantedmysql

Description

Problem Description

Following the get started guide step by step I was willing to run insert code with mysql.

        // ...
        let inserted = diesel::insert_into(entities::table)
            .values(&ext)
            .get_result::<Entity>(&conn)
            .unwrap();

But I was constantly getting a compile error.

the trait bound `diesel::mysql::Mysql: diesel::backend::SupportsReturningClause` is not satisfied
required because of the requirements on the impl of `diesel::query_builder::QueryFragment<diesel::mysql::Mysql>` for `diesel::query_builder::returning_clause::ReturningClause<schema::extension::columns::id>`
required because of the requirements on the impl of `diesel::query_builder::QueryFragment<diesel::mysql::Mysql>` for 
...

And eventually (after figuring out that execute doesn't return id :smile: ) I took a look at the doc and it seems to me currently it's impossible to run such code with mysql since its supported only by postgress right?

https://docs.diesel.rs/diesel/backend/trait.SupportsReturningClause.html

What are you trying to accomplish?

If it's true I would consider adding some information somewhere that it's not work with mysql could reduce peoples time spent on trying to resolve it. Probably in get_result doc comment.

Comment

I may be incorrect in my assumptions in which case I am sorry :disappointed:

And thank you for the crate.

Contributor guide