lpsmith / postgresql-simple

Mid-level client library for accessing PostgreSQL from Haskell
Other
206 stars 71 forks source link

Add interval Type #219

Open SamProtas opened 7 years ago

SamProtas commented 7 years ago

I took a stab at adding an Interval ADT to this library as per this conversation:

https://github.com/lpsmith/postgresql-simple/issues/176

Let me know your thoughts or any changes you'd like to see. FYI I'm a bit unsure about the appropriate precision for the Interval's fields.

Although I'm testing against PostgreSQL 9.6.3 I appear to have run into this bug (or something similar):

https://www.postgresql.org/message-id/CAMWF=HS++N9-NKsh-o5QSymvp0Np-VB0GdWwAt4uie1h8ZdNTQ@mail.gmail.com

so the Interval builder splits microseconds back out into hours/minutes/seconds/microseconds to keep the numbers low.

SamProtas commented 7 years ago

FWIW, the only Travis build that failed appears to also be failing on master (cabal version issue) and is for the oldest GHC (7.6.3) being tested.

lpsmith commented 7 years ago

Thanks for the PR. Yes, I am aware of the build issue with travis, and haven't looked into it too deeply yet. I will not hold that against you. :)

gbaz commented 5 years ago

this would be nice to merge