Filter `FieldName <-. [Nothing]` not finding expected results

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

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

評価

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

調査の方向性

まず、issue にリンクされている sqlite の完全な再現を実行し、その結果を列挙されている selectList の例と比較します。Persistent が Nothing を含むフィルターをどのように構築するかを追跡し、同じ動作を Postgres でも再現できるか確認します。selectList [PersonAge <-. [Nothing]] が Just のケースを壊さずに Jane を返せば完了です。

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

説明

I'm running into some odd behaviour where the filter FieldName <-. [Just v, Nothing] finds rows where FieldName is either null or v, but FieldName <-. [Nothing] doesn't find any rows at all.

  _johnId <- insert $ Person "John Doe" $ Just 35
  _janeId <- insert $ Person "Jane Doe" Nothing

  selectList [] [] -- finds no one
  selectList [PersonAge <-. [Nothing, Just 35]] [] -- finds John and Jane
  selectList [PersonAge <-. [Just 35]] [] -- finds John
  selectList [PersonAge <-. [Nothing]] [] -- expected to find Jane, but finds no one

Here's a complete repro using sqlite, but I've also observed this in Postgres.

主要言語
Haskell
スター
486
フォーク
307
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

yesodweb/persistent のほかの issue

yesodweb/persistent の issue をすべて見る

似ている issue

Haskell の issue をもっと見る

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

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