git.iko.soy/typeable/postgresql-simple
on master help sign in
Fix compatibility with PostgreSQL 8.1
commit2003875c34cfdcecea3d359d2077f459e920b6cc authorLeon P Smith <leon@melding-monads.com> dateThu 21 Jun 2012, 17:22 (14 years ago) parentd2c810e
2 files changed+8−4
postgresql-simple.cabal+1−1 src/Database/PostgreSQL/Simple/Internal.hs+7−3
postgresql-simple.cabal+1−1
@@ -1,5 +1,5 @@
11Name: postgresql-simple
2−Version: 0.2
2+Version: 0.2.0.1
33Synopsis: Mid-Level PostgreSQL client library
44Description:
55 Mid-Level PostgreSQL client library, forked from mysql-simple.
src/Database/PostgreSQL/Simple/Internal.hs+7−3
@@ -153,9 +153,13 @@ connectPostgreSQL connstr = do
153153 connectionHandle <- newMVar conn
154154 connectionObjects <- newMVar (IntMap.empty)
155155 let wconn = Connection{..}
156− _ <- execute_ wconn "SET standard_conforming_strings TO on;\
157− \SET datestyle TO ISO"
158− return Connection{..}
156+ version <- PQ.serverVersion conn
157+ let settings
158+ | version < 80200 = "SET datestyle TO ISO"
159+ | otherwise = "SET standard_conforming_strings TO on;\
160+ \SET datestyle TO ISO"
161+ _ <- execute_ wconn settings
162+ return wconn
159163 _ -> do
160164 msg <- maybe "connectPostgreSQL error" id <$> PQ.errorMessage conn
161165 throwIO $ SqlError { sqlNativeError = -1 -- FIXME?