diesel-rs/diesel

SupportsReturningClause mysql

Open

#2.535 geöffnet am 9. Okt. 2020

Auf GitHub ansehen
 (16 Kommentare) (9 Reaktionen) (1 zugewiesene Person)Rust (1.003 Forks)batch import
documentationhelp wantedmysql

Repository-Metriken

Stars
 (12.054 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 30T 16h) (30 gemergte PRs in 30 T)

Beschreibung

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