diesel-rs/diesel

SupportsReturningClause mysql

Open

#2 535 ouverte le 9 oct. 2020

Voir sur GitHub
 (16 commentaires) (9 réactions) (1 assigné)Rust (1 003 forks)batch import
documentationhelp wantedmysql

Métriques du dépôt

Stars
 (12 054 stars)
Métriques de merge PR
 (Merge moyen 30j 16h) (30 PRs mergées en 30 j)

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.

Guide contributeur