diesel-rs/diesel

SupportsReturningClause mysql

Open

#2,535 建立於 2020年10月9日

在 GitHub 查看
 (16 留言) (9 反應) (1 負責人)Rust (12,054 star) (1,003 fork)batch import
documentationhelp wantedmysql

描述

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.

貢獻者指南

SupportsReturningClause mysql · diesel-rs/diesel#2535 | Good First Issue