As described in the FromField module, postgresql-simple will only do client-side conversions between numerical types when there is no possibility of overflow or loss of precision. Pay attention, especially to the list of types in the peaks for instance FromField Int : "int2, int4, as well as compiled as 64-bit code, int8. This library was compiled as 32-bit code." The last part of this comment, of course, is specific to the assembly that the hacker himself performs.
On 32-bit platforms, Int is a 32-bit integer, and on 64-bit platforms, Int is a 64-bit integer. If you use Int32 , you will get the same exception. You can use Int64 or the Integer arbitrary precision type to avoid this problem on both platforms.
source share