Word64 does not roundtrip through a database correctly
まだ誰も着手していません。
評価
調査の方向性
まず、Haskell Word64 PersistField instance と、対応するデータベースバックエンドで使用されている PersistValue の処理を見つけます。issue で説明されている SQLite の動作を参考にして、各バックエンドが Int64 を超える値をどのように保存し、並べ替えるかを比較します。対応するすべてのデータベースで Word64 値が正しい値とソート順を保持すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Bug Reports
The Word64 instance for PersistField does not roundtrip through databases correctly.
It uses fromIntegral for converting between Word64 and Int64.
While this does technically roundtrip, the database values will be silently wrong because negative values will be saved instead of positive ones.
Example:
This does technically roundtrip:
ghci> import Data.Word
ghci> import Data.Int
ghci> 2^64
18446744073709551616
ghci> fromIntegral (18446744073709551615 :: Word64) :: Int64
-1
ghci> fromIntegral (-1 :: Int64) :: Word64
18446744073709551615
BUT the database will contain -1, which does not sort in the same way.
Solutions
You could have another PersistValue constructor for Word64, but I'm not sure if all the "supported" databases support such a type.
As far as I can tell, sqlite supports larger integers by storing them as reals but I don't know about other databases:
sqlite> create table t1 (i INTEGER);
sqlite> insert into t1 values(18446744073709551615);
sqlite> insert into t1 values(0);
sqlite> insert into t1 values(1);
sqlite> select * from t1 order by i;
0
1
1.84467440737096e+19
sqlite> select typeof(i) from t1;
real
integer
integer
- 主要言語
- Haskell
- スター
- 486
- フォーク
- 307
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
yesodweb/persistent のほかの issue
-
use aeson >= 2.3.0.0 to avoid HSEC-2026-0007対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
yesodweb/persistent#1635 · コメント 1 件 · リアクション 1 件 ·
-
Typos in Documentation for Database.Persist.Quasi対応中かも @000wahab000 が 64 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
yesodweb/persistent#1634 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
yesodweb/persistent#1643 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
yesodweb/persistent#1642 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
yesodweb/persistent#1641 ·
yesodweb/persistent の issue をすべて見る
似ている issue
-
agent-ready area:skills
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
jmbarzee/temporal-architect#603 ·
メンテナーはふだん 1 日以内に返信
-
bug dependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
alunduil/network-arbitrary#251 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
`logProbability` returns `NaN` for the Poisson distribution with `λ = 0`対応中かも @youqad が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
haskell/statistics#235 ·
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100