git.iko.soy/typeable/postgresql-simple
on master help sign in
Merge pull request #121 from haskellari/libpq-0.10

Require postgresql-libpq-0.10

commitcc3a39b5a3893c30cfa2442805a1a421325d6b3a authorOleg Grenrus <oleg.grenrus@iki.fi> dateSun 30 Jul 2023, 23:33 (3 years ago) parent27a1345b81aad3
14 files changed+15−167
.github/workflows/haskell-ci.yml+2−32 .github/workflows/simple.yml+1−1 CHANGES.md+4−1 postgresql-simple.cabal+8−33 src/Database/PostgreSQL/Simple/Compat.hs−53 src/Database/PostgreSQL/Simple/Copy.hs−4 src/Database/PostgreSQL/Simple/Errors.hs−1 src/Database/PostgreSQL/Simple/HStore/Implementation.hs−6 src/Database/PostgreSQL/Simple/Internal.hs−4 src/Database/PostgreSQL/Simple/Internal/PQResultUtils.hs−4 src/Database/PostgreSQL/Simple/Notification.hs−17 src/Database/PostgreSQL/Simple/Ok.hs−4 src/Database/PostgreSQL/Simple/ToField.hs−4 src/Database/PostgreSQL/Simple/Types.hs−3
.github/workflows/haskell-ci.yml+2−32
@@ -73,36 +73,6 @@ jobs:
7373 compilerVersion: 8.6.5
7474 setup-method: hvr-ppa
7575 allow-failure: false
76− - compiler: ghc-8.4.4
77− compilerKind: ghc
78− compilerVersion: 8.4.4
79− setup-method: hvr-ppa
80− allow-failure: false
81− - compiler: ghc-8.2.2
82− compilerKind: ghc
83− compilerVersion: 8.2.2
84− setup-method: hvr-ppa
85− allow-failure: false
86− - compiler: ghc-8.0.2
87− compilerKind: ghc
88− compilerVersion: 8.0.2
89− setup-method: hvr-ppa
90− allow-failure: false
91− - compiler: ghc-7.10.3
92− compilerKind: ghc
93− compilerVersion: 7.10.3
94− setup-method: hvr-ppa
95− allow-failure: false
96− - compiler: ghc-7.8.4
97− compilerKind: ghc
98− compilerVersion: 7.8.4
99− setup-method: hvr-ppa
100− allow-failure: false
101− - compiler: ghc-7.6.3
102− compilerKind: ghc
103− compilerVersion: 7.6.3
104− setup-method: hvr-ppa
105− allow-failure: false
10676 fail-fast: false
10777 steps:
10878 - name: apt
@@ -229,8 +199,8 @@ jobs:
229199 touch cabal.project
230200 touch cabal.project.local
231201 echo "packages: ${PKGDIR_postgresql_simple}" >> cabal.project
232− if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package postgresql-simple" >> cabal.project ; fi
233− if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
202+ echo "package postgresql-simple" >> cabal.project
203+ echo " ghc-options: -Werror=missing-methods" >> cabal.project
234204 cat >> cabal.project <<EOF
235205 allow-newer: cryptohash-md5-0.11.100.1:base
236206 EOF
.github/workflows/simple.yml+1−1
@@ -14,7 +14,7 @@ jobs:
1414 strategy:
1515 matrix:
1616 os: [macos-latest, windows-latest]
17− ghc: ['8.10','9.0','9.2','9.4.2']
17+ ghc: ['8.10','9.0','9.2','9.4.5','9.6.2']
1818 fail-fast: false
1919 timeout-minutes:
2020 60
CHANGES.md+4−1
@@ -1,6 +1,9 @@
1−### Version 0.7 (2023-07-31)
1+### Version 0.7.0.0 (2023-07-31)
22
33 * Remove Eq Null instance. (Future `base` may break it, we remove it profilacticly).
4+ * Use `postgresql-libpq >=0.10.0.0`. It includes critical fixes,
5+ by using `postgresql-simple >=0.7` you won't get older `postgresql-libpq`.
6+ * Drop support for GHC prior 8.6
47
58### Version 0.6.5.1 (2023-07-09)
69
postgresql-simple.cabal+8−33
@@ -1,6 +1,6 @@
11cabal-version: 1.12
22name: postgresql-simple
3−version: 0.6.5.1
3+version: 0.7.0.0
44synopsis: Mid-Level PostgreSQL client library
55description:
66 Mid-Level PostgreSQL client library, forked from mysql-simple.
@@ -23,13 +23,7 @@ extra-source-files:
2323 test/results/unique-constraint-violation.expected
2424
2525tested-with:
26− GHC ==7.6.3
27− || ==7.8.4
28− || ==7.10.3
29− || ==8.0.2
30− || ==8.2.2
31− || ==8.4.4
32− || ==8.6.5
26+ GHC ==8.6.5
3327 || ==8.8.4
3428 || ==8.10.7
3529 || ==9.0.2
@@ -81,13 +75,13 @@ library
8175
8276 -- GHC bundled libs
8377 build-depends:
84− base >=4.6.0.0 && <4.19
85− , bytestring >=0.10.0.0 && <0.12
86− , containers >=0.5.0.0 && <0.7
87− , template-haskell >=2.8.0.0 && <2.21
78+ base >=4.12.0.0 && <4.19
79+ , bytestring >=0.10.8.2 && <0.12
80+ , containers >=0.6.0.1 && <0.7
81+ , template-haskell >=2.14.0.0 && <2.21
8882 , text >=1.2.3.0 && <1.3 || >=2.0 && <2.1
8983 , time-compat >=1.9.5 && <1.12
90− , transformers >=0.3.0.0 && <0.7
84+ , transformers >=0.5.6.2 && <0.7
9185
9286 -- Other dependencies
9387 build-depends:
@@ -97,19 +91,11 @@ library
9791 , case-insensitive >=1.2.0.11 && <1.3
9892 , hashable >=1.2.7.0 && <1.5
9993 , Only >=0.1 && <0.1.1
100− , postgresql-libpq >=0.9.4.3 && <0.10
94+ , postgresql-libpq >=0.10.0.0 && <0.11
10195 , scientific >=0.3.6.2 && <0.4
10296 , uuid-types >=1.0.3 && <1.1
10397 , vector >=0.12.0.1 && <0.14
10498
105− if !impl(ghc >=8.0)
106− build-depends:
107− fail >=4.9.0.0 && <4.10
108− , semigroups >=0.18.5 && <0.21
109−
110− if !impl(ghc >=7.6)
111− build-depends: ghc-prim
112−
11399 default-extensions:
114100 BangPatterns
115101 DoAndIfThenElse
@@ -123,15 +109,7 @@ source-repository head
123109 type: git
124110 location: http://github.com/haskellari/postgresql-simple
125111
126−source-repository this
127− type: git
128− location: http://github.com/haskellari/postgresql-simple
129− tag: v0.6.3
130−
131112test-suite inspection
132− if !impl(ghc >=8.0)
133− buildable: False
134−
135113 default-language: Haskell2010
136114 type: exitcode-stdio-1.0
137115 hs-source-dirs: test
@@ -184,9 +162,6 @@ test-suite test
184162 , time-compat
185163 , vector
186164
187− if !impl(ghc >=7.6)
188− build-depends: ghc-prim
189−
190165benchmark select
191166 default-language: Haskell2010
192167 type: exitcode-stdio-1.0
src/Database/PostgreSQL/Simple/Compat.hs−53
@@ -12,36 +12,13 @@ module Database.PostgreSQL.Simple.Compat
1212 ) where
1313
1414import qualified Control.Exception as E
15−import Data.Monoid
1615import Data.ByteString (ByteString)
17−#if MIN_VERSION_bytestring(0,10,0)
1816import Data.ByteString.Lazy (toStrict)
19−#else
20−import qualified Data.ByteString as B
21−import Data.ByteString.Lazy (toChunks)
22−#endif
2317import Data.ByteString.Builder (Builder, toLazyByteString)
24−
25−#if MIN_VERSION_scientific(0,3,0)
2618import Data.Text.Lazy.Builder.Scientific (scientificBuilder)
27−#else
28−import Data.Scientific (scientificBuilder)
29−#endif
30−
31−#if __GLASGOW_HASKELL__ >= 702
3219import System.IO.Unsafe (unsafeDupablePerformIO)
33−#elif __GLASGOW_HASKELL__ >= 611
34−import GHC.IO (unsafeDupablePerformIO)
35−#else
36−import GHC.IOBase (unsafeDupablePerformIO)
37−#endif
38−
3920import Data.Fixed (Pico)
40−#if MIN_VERSION_base(4,7,0)
4121import Data.Fixed (Fixed(MkFixed))
42−#else
43−import Unsafe.Coerce (unsafeCoerce)
44−#endif
4522
4623-- | Like 'E.mask', but backported to base before version 4.3.0.
4724--
@@ -51,44 +28,14 @@ import Unsafe.Coerce (unsafeCoerce)
5128-- 'withTransactionMode' function calls the restore callback only once, so we
5229-- don't need that polymorphism.
5330mask :: ((IO a -> IO a) -> IO b) -> IO b
54−#if MIN_VERSION_base(4,3,0)
5531mask io = E.mask $ \restore -> io restore
56−#else
57−mask io = do
58− b <- E.blocked
59− E.block $ io $ \m -> if b then m else E.unblock m
60−#endif
6132{-# INLINE mask #-}
6233
63−#if !MIN_VERSION_base(4,5,0)
64−infixr 6 <>
65−
66−(<>) :: Monoid m => m -> m -> m
67−(<>) = mappend
68−{-# INLINE (<>) #-}
69−#endif
70−
7134toByteString :: Builder -> ByteString
72−#if MIN_VERSION_bytestring(0,10,0)
7335toByteString x = toStrict (toLazyByteString x)
74−#else
75−toByteString x = B.concat (toChunks (toLazyByteString x))
76−#endif
77−
78−#if MIN_VERSION_base(4,7,0)
7936
8037toPico :: Integer -> Pico
8138toPico = MkFixed
8239
8340fromPico :: Pico -> Integer
8441fromPico (MkFixed i) = i
85−
86−#else
87−
88−toPico :: Integer -> Pico
89−toPico = unsafeCoerce
90−
91−fromPico :: Pico -> Integer
92−fromPico = unsafeCoerce
93−
94−#endif
src/Database/PostgreSQL/Simple/Copy.hs−4
@@ -86,12 +86,8 @@ doCopy funcName conn template q = do
8686 PQ.TuplesOk -> err
8787 PQ.CopyOut -> return ()
8888 PQ.CopyIn -> return ()
89−#if MIN_VERSION_postgresql_libpq(0,9,3)
9089 PQ.CopyBoth -> errMsg "COPY BOTH is not supported"
91−#endif
92−#if MIN_VERSION_postgresql_libpq(0,9,2)
9390 PQ.SingleTuple -> errMsg "single-row mode is not supported"
94−#endif
9591 PQ.BadResponse -> throwResultError funcName result status
9692 PQ.NonfatalError -> throwResultError funcName result status
9793 PQ.FatalError -> throwResultError funcName result status
src/Database/PostgreSQL/Simple/Errors.hs−1
@@ -25,7 +25,6 @@ module Database.PostgreSQL.Simple.Errors
2525 )
2626 where
2727
28−import Control.Applicative
2928import Control.Exception as E
3029
3130import Data.Attoparsec.ByteString.Char8
src/Database/PostgreSQL/Simple/HStore/Implementation.hs−6
@@ -22,9 +22,6 @@ import Data.ByteString.Builder (Builder, byteString, char8)
2222import qualified Data.ByteString.Builder as BU
2323import Data.ByteString.Internal (c2w, w2c)
2424import qualified Data.ByteString.Lazy as BL
25−#if !MIN_VERSION_bytestring(0,10,0)
26−import qualified Data.ByteString.Lazy.Internal as BL (foldrChunks)
27−#endif
2825import Data.Map(Map)
2926import qualified Data.Map as Map
3027import Data.Text(Text)
@@ -69,9 +66,6 @@ instance Semigroup HStoreBuilder where
6966
7067instance Monoid HStoreBuilder where
7168 mempty = Empty
72−#if !(MIN_VERSION_base(4,11,0))
73− mappend = (<>)
74−#endif
7569
7670class ToHStoreText a where
7771 toHStoreText :: a -> HStoreText
src/Database/PostgreSQL/Simple/Internal.hs−4
@@ -34,7 +34,6 @@ import Data.Int (Int64)
3434import qualified Data.IntMap as IntMap
3535import Data.IORef
3636import Data.Maybe(fromMaybe)
37−import Data.Monoid
3837import Data.String
3938import qualified Data.Text as T
4039import qualified Data.Text.Encoding as TE
@@ -490,9 +489,6 @@ instance Alternative Conversion where
490489 Errors _ -> (oka <|>) <$> runConversion mb conn
491490
492491instance Monad Conversion where
493−#if !(MIN_VERSION_base(4,8,0))
494− return = pure
495−#endif
496492 m >>= f = Conversion $ \conn -> do
497493 oka <- runConversion m conn
498494 case oka of
src/Database/PostgreSQL/Simple/Internal/PQResultUtils.hs−4
@@ -76,12 +76,8 @@ finishQueryWith' q result k = do
7676 PQ.CommandOk -> queryErr "query resulted in a command response (did you mean to use `execute` or forget a RETURNING?)"
7777 PQ.CopyOut -> queryErr "query: COPY TO is not supported"
7878 PQ.CopyIn -> queryErr "query: COPY FROM is not supported"
79−#if MIN_VERSION_postgresql_libpq(0,9,3)
8079 PQ.CopyBoth -> queryErr "query: COPY BOTH is not supported"
81−#endif
82−#if MIN_VERSION_postgresql_libpq(0,9,2)
8380 PQ.SingleTuple -> queryErr "query: single-row mode is not supported"
84−#endif
8581 PQ.BadResponse -> throwResultError "query" result status
8682 PQ.NonfatalError -> throwResultError "query" result status
8783 PQ.FatalError -> throwResultError "query" result status
src/Database/PostgreSQL/Simple/Notification.hs−17
@@ -47,8 +47,6 @@ import GHC.IO.Exception ( ioe_location )
4747
4848#if defined(mingw32_HOST_OS)
4949import Control.Concurrent ( threadDelay )
50−#elif !MIN_VERSION_base(4,7,0)
51−import Control.Concurrent ( threadWaitRead )
5250#else
5351import GHC.Conc ( atomically )
5452import Control.Concurrent ( threadWaitReadSTM )
@@ -94,21 +92,6 @@ getNotification conn = join $ withConnection conn fetch
9492 -- with async exceptions, whereas threadDelay can.
9593 Just _fd -> do
9694 return (threadDelay 1000000 >> loop)
97−#elif !MIN_VERSION_base(4,7,0)
98− -- Technically there's a race condition that is usually benign.
99− -- If the connection is closed or reset after we drop the
100− -- lock, and then the fd index is reallocated to a new
101− -- descriptor before we call threadWaitRead, then
102− -- we could end up waiting on the wrong descriptor.
103− --
104− -- Now, if the descriptor becomes readable promptly, then
105− -- it's no big deal as we'll wake up and notice the change
106− -- on the next iteration of the loop. But if are very
107− -- unlucky, then we could end up waiting a long time.
108− Just fd -> do
109− return $ do
110− threadWaitRead fd `catch` (throwIO . setIOErrorLocation)
111− loop
11295#else
11396 -- This case fixes the race condition above. By registering
11497 -- our interest in the descriptor before we drop the lock,
src/Database/PostgreSQL/Simple/Ok.hs−4
@@ -72,10 +72,6 @@ instance MonadPlus Ok where
7272 mplus = (<|>)
7373
7474instance Monad Ok where
75−#if !(MIN_VERSION_base(4,8,0))
76− return = pure
77−#endif
78−
7975 Errors es >>= _ = Errors es
8076 Ok a >>= f = f a
8177
src/Database/PostgreSQL/Simple/ToField.hs−4
@@ -59,11 +59,7 @@ import qualified Data.Vector as V
5959import qualified Database.PostgreSQL.LibPQ as PQ
6060import Database.PostgreSQL.Simple.Time
6161import Data.Scientific (Scientific)
62−#if MIN_VERSION_scientific(0,3,0)
6362import Data.Text.Lazy.Builder.Scientific (scientificBuilder)
64−#else
65−import Data.Scientific (scientificBuilder)
66−#endif
6763import Foreign.C.Types (CUInt(..))
6864
6965-- | How to render an element when substituting it into a query.
src/Database/PostgreSQL/Simple/Types.hs−3
@@ -93,9 +93,6 @@ instance Semigroup Query where
9393
9494instance Monoid Query where
9595 mempty = Query B.empty
96−#if !(MIN_VERSION_base(4,11,0))
97− mappend = (<>)
98−#endif
9996
10097-- | Wrap a list of values for use in an @IN@ clause. Replaces a
10198-- single \"@?@\" character with a parenthesized list of rendered