Diesel error : the trait bound `*const str: diesel::deserialize::FromSql<diesel::sql_types::Bool, _>` is not satisfied

Hello,
I am stuck for hours on some problem..
I get the following error :

   Compiling neobug v0.1.0 (/home/neolex/dev/neobug/backend)
error[E0277]: the trait bound `bool: diesel::deserialize::FromSql<diesel::sql_types::Text, diesel::pg::Pg>` is not satisfied
  --> src/models/program_model.rs:48:14
   |
48 |             .get_result(&*conn)
   |              ^^^^^^^^^^ the trait `diesel::deserialize::FromSql<diesel::sql_types::Text, diesel::pg::Pg>` is not implemented for `bool`
   |
   = help: the following implementations were found:
             <bool as diesel::deserialize::FromSql<diesel::sql_types::Bool, diesel::pg::Pg>>
   = note: required because of the requirements on the impl of `diesel::Queryable<diesel::sql_types::Text, diesel::pg::Pg>` for `bool`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), diesel::pg::Pg>` for `(i32, std::string::String, std::string::String, bool)`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), diesel::pg::Pg>` for `models::program_model::Program`
   = note: required because of the requirements on the impl of `diesel::query_dsl::LoadQuery<diesel::PgConnection, models::program_model::Program>` for `diesel::query_builder::InsertStatement<schema::programs::table, diesel::query_builder::ValuesClause<(diesel::insertable::ColumnInsertValue<schema::programs::columns::name, diesel::expression::bound::Bound<diesel::sql_types::Text, &std::string::String>>, diesel::insertable::ColumnInsertValue<schema::programs::columns::platform, diesel::expression::bound::Bound<diesel::sql_types::Text, &std::string::String>>, diesel::insertable::ColumnInsertValue<schema::programs::columns::private, diesel::expression::bound::Bound<diesel::sql_types::Bool, &bool>>), schema::programs::table>>`

error[E0277]: the trait bound `*const str: diesel::deserialize::FromSql<diesel::sql_types::Bool, diesel::pg::Pg>` is not satisfied
  --> src/models/program_model.rs:48:14
   |
48 |             .get_result(&*conn)
   |              ^^^^^^^^^^ the trait `diesel::deserialize::FromSql<diesel::sql_types::Bool, diesel::pg::Pg>` is not implemented for `*const str`
   |
   = help: the following implementations were found:
             <*const [u8] as diesel::deserialize::FromSql<diesel::sql_types::Binary, DB>>
             <*const str as diesel::deserialize::FromSql<diesel::sql_types::Text, DB>>
   = note: required because of the requirements on the impl of `diesel::deserialize::FromSql<diesel::sql_types::Bool, diesel::pg::Pg>` for `std::string::String`
   = note: required because of the requirements on the impl of `diesel::Queryable<diesel::sql_types::Bool, diesel::pg::Pg>` for `std::string::String`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), diesel::pg::Pg>` for `(i32, std::string::String, std::string::String, bool)`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), diesel::pg::Pg>` for `models::program_model::Program`
   = note: required because of the requirements on the impl of `diesel::query_dsl::LoadQuery<diesel::PgConnection, models::program_model::Program>` for `diesel::query_builder::InsertStatement<schema::programs::table, diesel::query_builder::ValuesClause<(diesel::insertable::ColumnInsertValue<schema::programs::columns::name, diesel::expression::bound::Bound<diesel::sql_types::Text, &std::string::String>>, diesel::insertable::ColumnInsertValue<schema::programs::columns::platform, diesel::expression::bound::Bound<diesel::sql_types::Text, &std::string::String>>, diesel::insertable::ColumnInsertValue<schema::programs::columns::private, diesel::expression::bound::Bound<diesel::sql_types::Bool, &bool>>), schema::programs::table>>`

error[E0277]: the trait bound `bool: diesel::deserialize::FromSql<diesel::sql_types::Text, diesel::pg::Pg>` is not satisfied
  --> src/models/program_model.rs:59:14
   |
59 |             .get_result(&*conn)
   |              ^^^^^^^^^^ the trait `diesel::deserialize::FromSql<diesel::sql_types::Text, diesel::pg::Pg>` is not implemented for `bool`
   |
   = help: the following implementations were found:
             <bool as diesel::deserialize::FromSql<diesel::sql_types::Bool, diesel::pg::Pg>>
   = note: required because of the requirements on the impl of `diesel::Queryable<diesel::sql_types::Text, diesel::pg::Pg>` for `bool`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), diesel::pg::Pg>` for `(i32, std::string::String, std::string::String, bool)`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), diesel::pg::Pg>` for `models::program_model::Program`
   = note: required because of the requirements on the impl of `diesel::query_dsl::LoadQuery<diesel::PgConnection, models::program_model::Program>` for `diesel::query_builder::UpdateStatement<schema::programs::table, diesel::query_builder::where_clause::WhereClause<diesel::expression::operators::Eq<schema::programs::columns::id, diesel::expression::bound::Bound<diesel::sql_types::Integer, i32>>>, (diesel::query_builder::update_statement::changeset::Assign<schema::programs::columns::name, diesel::expression::bound::Bound<diesel::sql_types::Text, std::string::String>>, diesel::query_builder::update_statement::changeset::Assign<schema::programs::columns::platform, diesel::expression::bound::Bound<diesel::sql_types::Text, std::string::String>>, diesel::query_builder::update_statement::changeset::Assign<schema::programs::columns::private, diesel::expression::bound::Bound<diesel::sql_types::Bool, bool>>)>`

error[E0277]: the trait bound `*const str: diesel::deserialize::FromSql<diesel::sql_types::Bool, diesel::pg::Pg>` is not satisfied
  --> src/models/program_model.rs:59:14
   |
59 |             .get_result(&*conn)
   |              ^^^^^^^^^^ the trait `diesel::deserialize::FromSql<diesel::sql_types::Bool, diesel::pg::Pg>` is not implemented for `*const str`
   |
   = help: the following implementations were found:
             <*const [u8] as diesel::deserialize::FromSql<diesel::sql_types::Binary, DB>>
             <*const str as diesel::deserialize::FromSql<diesel::sql_types::Text, DB>>
   = note: required because of the requirements on the impl of `diesel::deserialize::FromSql<diesel::sql_types::Bool, diesel::pg::Pg>` for `std::string::String`
   = note: required because of the requirements on the impl of `diesel::Queryable<diesel::sql_types::Bool, diesel::pg::Pg>` for `std::string::String`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), diesel::pg::Pg>` for `(i32, std::string::String, std::string::String, bool)`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), diesel::pg::Pg>` for `models::program_model::Program`
   = note: required because of the requirements on the impl of `diesel::query_dsl::LoadQuery<diesel::PgConnection, models::program_model::Program>` for `diesel::query_builder::UpdateStatement<schema::programs::table, diesel::query_builder::where_clause::WhereClause<diesel::expression::operators::Eq<schema::programs::columns::id, diesel::expression::bound::Bound<diesel::sql_types::Integer, i32>>>, (diesel::query_builder::update_statement::changeset::Assign<schema::programs::columns::name, diesel::expression::bound::Bound<diesel::sql_types::Text, std::string::String>>, diesel::query_builder::update_statement::changeset::Assign<schema::programs::columns::platform, diesel::expression::bound::Bound<diesel::sql_types::Text, std::string::String>>, diesel::query_builder::update_statement::changeset::Assign<schema::programs::columns::private, diesel::expression::bound::Bound<diesel::sql_types::Bool, bool>>)>`

error[E0277]: the trait bound `bool: diesel::deserialize::FromSql<diesel::sql_types::Text, _>` is not satisfied
  --> src/models/program_model.rs:71:14
   |
71 |             .load::<Program>(&*conn)
   |              ^^^^ the trait `diesel::deserialize::FromSql<diesel::sql_types::Text, _>` is not implemented for `bool`
   |
   = help: the following implementations were found:
             <bool as diesel::deserialize::FromSql<diesel::sql_types::Bool, diesel::pg::Pg>>
   = note: required because of the requirements on the impl of `diesel::Queryable<diesel::sql_types::Text, _>` for `bool`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), _>` for `(i32, std::string::String, std::string::String, bool)`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), _>` for `models::program_model::Program`
   = note: required because of the requirements on the impl of `diesel::query_dsl::LoadQuery<_, models::program_model::Program>` for `diesel::query_builder::SelectStatement<schema::programs::table, diesel::query_builder::select_clause::DefaultSelectClause, diesel::query_builder::distinct_clause::NoDistinctClause, diesel::query_builder::where_clause::NoWhereClause, diesel::query_builder::order_clause::OrderClause<diesel::expression::operators::Desc<schema::programs::columns::id>>>`

error[E0277]: the trait bound `*const str: diesel::deserialize::FromSql<diesel::sql_types::Bool, _>` is not satisfied
  --> src/models/program_model.rs:71:14
   |
71 |             .load::<Program>(&*conn)
   |              ^^^^ the trait `diesel::deserialize::FromSql<diesel::sql_types::Bool, _>` is not implemented for `*const str`
   |
   = help: the following implementations were found:
             <*const [u8] as diesel::deserialize::FromSql<diesel::sql_types::Binary, DB>>
             <*const str as diesel::deserialize::FromSql<diesel::sql_types::Text, DB>>
   = note: required because of the requirements on the impl of `diesel::deserialize::FromSql<diesel::sql_types::Bool, _>` for `std::string::String`
   = note: required because of the requirements on the impl of `diesel::Queryable<diesel::sql_types::Bool, _>` for `std::string::String`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), _>` for `(i32, std::string::String, std::string::String, bool)`
   = note: required because of the requirements on the impl of `diesel::Queryable<(diesel::sql_types::Integer, diesel::sql_types::Text, diesel::sql_types::Bool, diesel::sql_types::Text), _>` for `models::program_model::Program`
   = note: required because of the requirements on the impl of `diesel::query_dsl::LoadQuery<_, models::program_model::Program>` for `diesel::query_builder::SelectStatement<schema::programs::table, diesel::query_builder::select_clause::DefaultSelectClause, diesel::query_builder::distinct_clause::NoDistinctClause, diesel::query_builder::where_clause::NoWhereClause, diesel::query_builder::order_clause::OrderClause<diesel::expression::operators::Desc<schema::programs::columns::id>>>`

error: aborting due to 6 previous errors

My database is

CREATE TABLE programs (
    id SERIAL PRIMARY KEY,
    name VARCHAR NOT NULL DEFAULT '',
    private BOOLEAN NOT NULL DEFAULT TRUE,
    platform VARCHAR NOT NULL DEFAULT 'HackerOne'
)

program_model.rs

use crate::connection::DbConn;
use crate::schema::programs;
use diesel::prelude::*;
use serde_derive::{Deserialize, Serialize};

#[derive(Queryable, Serialize, Clone)]
pub struct Program {
    pub id: i32,
    pub name: String,
    #[serde(default = "ret_hackerone")]
    pub platform: String,
    #[serde(default = "ret_true")]
    pub private: bool,
}

#[derive(Insertable, Deserialize, Clone)]
#[table_name = "programs"]
pub struct NewProgram {
    pub name: String,
    #[serde(default = "ret_hackerone")]
    pub platform: String,
    #[serde(default = "ret_true")]
    pub private: bool,
}

#[derive(Deserialize, Clone)]
pub struct NewProgramId {
    pub id: i32,
    pub name: String,
    #[serde(default = "ret_hackerone")]
    pub platform: String,
    #[serde(default = "ret_true")]
    pub private: bool,
}

fn ret_hackerone() ->  String {
    String::from("HackerOne")
}
fn ret_true() -> bool {
    true
}

impl Program {

    pub fn insert(conn: DbConn, new_program: NewProgram) -> Program {
        diesel::insert_into(programs::table)
            .values(&new_program)
            .get_result(&*conn)
            .unwrap()
    }

    pub fn update_program(conn: DbConn, program: NewProgramId) -> Program {
        let target = programs::table.filter(programs::columns::id.eq(program.id));
        diesel::update(target)
            .set((programs::columns::name.eq(program.name),
                  programs::columns::platform.eq(program.platform),
                  programs::columns::private.eq(program.private),
            ))
            .get_result(&*conn)
            .unwrap()

    }
    pub fn delete_program(conn: DbConn, id: i32) -> bool {
        let target = programs::table.filter(programs::columns::id.eq(id));
        diesel::delete(target).execute(&*conn).unwrap() == 1
    }

    pub fn get_programs(conn: DbConn) -> Vec<Program> {
        programs::table
            .order(programs::columns::id.desc())
            .load::<Program>(&*conn)
            .unwrap()
    }


}

program_api.rs

use crate::connection::DbConn;
use crate::models::program_model::{NewProgram, Program, NewProgramId};
use rocket::{self, delete, get, post, put};
use rocket_contrib::json::Json;
use serde_json::{json, Value};

#[post("/", data = "<new_program>")]
pub fn create_program(conn: DbConn, new_program: Json<NewProgram>) -> Json<Program> {
    let programs = Program::insert(conn, new_program.to_owned());
    Json(programs)
}

#[put("/", data = "<new_program>")]
pub fn update_program(conn: DbConn, new_program: Json<NewProgramId>) -> Json<Program> {
    let programs = Program::update_program(conn, new_program.to_owned());
    Json(programs)
}

#[get("/")]
pub fn get_programs(conn: DbConn) -> Json<Vec<Program>> {
    let programs = Program::get_programs(conn);
    Json(programs)
}

#[delete("/<id>")]
pub fn delete_program(conn: DbConn, id: i32) -> Json<Value> {
    if Program::delete_program(conn, id) {
        Json(json!({"result":"success"}))
    } else {
        Json(json!({"result":"failure"}))
    }
}

I have no idea from what the error is, I used almost the same code for another part of the application and it worked...

Best regards !

I found the error : The order wasn't the same for SQL and Rust