-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Word64 values in Haskell schema are treated as Int64 in Persistent large values be displayed as negative #163
Comments
The problem here is that the ledger allows arbitrary (and nonsensical) values for the pledge amount (and fixedCost). Specifically that allow any Even |
I have a potential fix for this but it I am waiting on some dependency and Nix/CI issues to be fixed before I can test my solution. |
I have a fix for this on my |
This commit uses a version of persistent that has been modified to add proper Word64 support. Previously when the schema used `Word64` as the column type, Persistent would use `SqlInt64` as the SQL representation which means that `Word64` values above `maxBound :: Int64` would be stored as negative values in the database. That is fine for a database only accessed from Haskell but is a pain in the neck when the database is used as an interop layer for other languages. The solution is to define a 'DbWord64' newtype wrapper around 'Word64' and then map 'DbWord64' to the 'numeric(20,0)' SQL type with a bounds check. Closes: #163
This commit uses a version of persistent that has been modified to add proper Word64 support. Previously when the schema used `Word64` as the column type, Persistent would use `SqlInt64` as the SQL representation which means that `Word64` values above `maxBound :: Int64` would be stored as negative values in the database. That is fine for a database only accessed from Haskell but is a pain in the neck when the database is used as an interop layer for other languages. The solution is to define a 'DbWord64' newtype wrapper around 'Word64' and then map 'DbWord64' to the 'numeric(20,0)' SQL type with a bounds check. Closes: #163
This commit uses a version of persistent that has been modified to ad Previously when the schema used `Word64` as the column type, Persistent would use `SqlInt64` as the SQL representation which means that `Word64` values above `maxBound :: Int64` would be stored as negative values in the database. That is fine for a database only accessed from Haskell but is a pain in the neck when the database is used as an interop layer for other languages. The solution is to define a 'DbWord64' newtype wrapper around 'Word64' and then map 'DbWord64' to the 'numeric(20,0)' SQL type with a bounds check. Closes: #163
Previously when the schema used `Word64` as the column type, Persistent would use `SqlInt64` as the SQL representation which means that `Word64` values above `maxBound :: Int64` would be stored as negative values in the database. That is fine for a database only accessed from Haskell but is a pain in the neck when the database is used as an interop layer for other languages. The solution is to define a 'DbWord64' newtype wrapper around 'Word64' and then map 'DbWord64' to the 'numeric(20,0)' SQL type with a bounds check. Closes: #163
SELECT * FROM pool WHERE hash='\xdc240e2e02c1ff7914a840749df10452b900531e43e99d7554e4a59d'
15 "binary data" 12345678000000 22733 14 0.1234 12345000000 424
37 "binary data" 1000000000000 22733 14 0.1234 12345000000 1044
327 "binary data" -2537764290116403776 22733 14 0.9999 -2537764290116403776 50091
The text was updated successfully, but these errors were encountered: