Skip to content

DB representation for Word64 values greater than maxBound :: Int64 are negative #1095

@erikd

Description

@erikd

Defining a column as Word64 and writing a value in the range [maxBoundInt64 +1 .. maxBoundWord64] results in a negative value (ie the Int64 bit pattern of the Word64) being inserted into the database.

The reason for this is that the Word64 type in the schema definition is converted to SqlInt64 which is then written to the database. The reverse is done when read the value is read, so the value is correct in Haskell land but the value in the database is negative. This is a problem for interop when the database is used from languages other then Haskell.

The obvious solution is to add an SqlWord64 constructor to the type to SqlType.

@parsonsmatt Is this a sane idea? Volunteering to do this if it is.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions