Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

the trait bound bool: std::convert::From<std::option::Option<bool>> is not satisfied

オープン
#4,065 コメント 4 件 リアクション 1 件 担当者 0 名 GitHub で見る

メンテナーはふだん 4 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
28/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
postgresql, rust, sql
領域
backend, databases

調査の方向性

Reproduce the compile error with the given sqlx::query_as! query and DBImportTorrent struct on Postgres. The CASE TRUE/FALSE is being inferred as Option<bool> while the field is bool. Start from how query_as! maps Postgres column types (boolean / CASE) onto Rust fields, then see why From<Option<bool>> is required. Done when that mapping compiles for a non-optional bool or the docs explain the needed type.

索引モデルが issue の本文から書いたものです。

説明

bug
I have found these related issues/pull requests

None

Description
         let rows = sqlx::query_as!(
            DBImportTorrent,
            r#"
            SELECT
                id,
                upload_factor,
                download_factor,
                seeders,
                leechers,
                times_completed,
                CASE
                    WHEN deleted_at IS NOT NULL THEN TRUE
                    ELSE FALSE
                END AS is_deleted
            FROM torrents
            "#
        )


#[derive(Debug)]
pub struct DBImportTorrent {
    pub id: i32,
    pub upload_factor: f64,
    pub download_factor: f64,
    pub seeders: i64,
    pub leechers: i64,
    pub times_completed: i32,
    pub is_deleted: bool,
} 

Throws this error: the trait bound bool: std::convert::From<std::option::Option<bool>> is not satisfied

Reproduction steps

Run the code above

SQLx version

0.8

Enabled SQLx features

"runtime-tokio", "tls-native-tls", "postgres", "chrono", "ipnetwork"

Database server and version

Postgres

Operating system

Asahi linux

Rust version

1.89.0

主要言語
Rust
スター
17.5k
フォーク
1.7k
平均マージ
3日 17時間
マージ済み PR(30日)
11

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

transact-rs/sqlx のほかの issue

transact-rs/sqlx の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。