Closed
Description
Example program:
{-# LANGUAGE OverloadedStrings #-}
import Database.PostgreSQL.Simple
import Data.Time
main :: IO ()
main = do
conn <- connectPostgreSQL "host=localhost port=5432 user=test dbname=test password=test"
execute_ conn "BEGIN TRANSACTION;"
execute_ conn "CREATE TABLE old_dates(tz TIMESTAMP WITH TIME ZONE NOT NULL);"
execute conn "INSERT INTO old_dates(tz) VALUES(?);"
[ UTCTime (fromGregorian 1900 1 1) 0
]
rows <- query_ conn "SELECT * FROM old_dates"
mapM_ print (rows :: [Only UTCTime])
The result is:
foo.hs: ConversionFailed {errSQLType = "timestamptz", errSQLTableOid = Just (Oid 43633), errSQLField = "tz", errHaskellType = "UTCTime", errMessage = "endOfInput"}
Looking into this more closely, it appears that- for some older dates- PostgreSQL returns a funky timezone along the lines of +02:03:04
.
Metadata
Metadata
Assignees
Labels
No labels