Skip to content

Commit cc3a39b

Browse files
authored
Merge pull request #121 from haskellari/libpq-0.10
Require postgresql-libpq-0.10
2 parents 27a1345 + b81aad3 commit cc3a39b

14 files changed

Lines changed: 15 additions & 167 deletions

File tree

.github/workflows/haskell-ci.yml

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 8 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
cabal-version: 1.12
22
name: postgresql-simple
3-
version: 0.6.5.1
3+
version: 0.7.0.0
44
synopsis: Mid-Level PostgreSQL client library
55
description:
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

2525
tested-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-
131112
test-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-
190165
benchmark select
191166
default-language: Haskell2010
192167
type: exitcode-stdio-1.0

src/Database/PostgreSQL/Simple/Compat.hs

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,13 @@ module Database.PostgreSQL.Simple.Compat
1212
) where
1313

1414
import qualified Control.Exception as E
15-
import Data.Monoid
1615
import Data.ByteString (ByteString)
17-
#if MIN_VERSION_bytestring(0,10,0)
1816
import Data.ByteString.Lazy (toStrict)
19-
#else
20-
import qualified Data.ByteString as B
21-
import Data.ByteString.Lazy (toChunks)
22-
#endif
2317
import Data.ByteString.Builder (Builder, toLazyByteString)
24-
25-
#if MIN_VERSION_scientific(0,3,0)
2618
import Data.Text.Lazy.Builder.Scientific (scientificBuilder)
27-
#else
28-
import Data.Scientific (scientificBuilder)
29-
#endif
30-
31-
#if __GLASGOW_HASKELL__ >= 702
3219
import System.IO.Unsafe (unsafeDupablePerformIO)
33-
#elif __GLASGOW_HASKELL__ >= 611
34-
import GHC.IO (unsafeDupablePerformIO)
35-
#else
36-
import GHC.IOBase (unsafeDupablePerformIO)
37-
#endif
38-
3920
import Data.Fixed (Pico)
40-
#if MIN_VERSION_base(4,7,0)
4121
import 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.
5330
mask :: ((IO a -> IO a) -> IO b) -> IO b
54-
#if MIN_VERSION_base(4,3,0)
5531
mask 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-
7134
toByteString :: Builder -> ByteString
72-
#if MIN_VERSION_bytestring(0,10,0)
7335
toByteString 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

8037
toPico :: Integer -> Pico
8138
toPico = MkFixed
8239

8340
fromPico :: Pico -> Integer
8441
fromPico (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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ module Database.PostgreSQL.Simple.Errors
2525
)
2626
where
2727

28-
import Control.Applicative
2928
import Control.Exception as E
3029

3130
import Data.Attoparsec.ByteString.Char8

src/Database/PostgreSQL/Simple/HStore/Implementation.hs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ import Data.ByteString.Builder (Builder, byteString, char8)
2222
import qualified Data.ByteString.Builder as BU
2323
import Data.ByteString.Internal (c2w, w2c)
2424
import 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
2825
import Data.Map(Map)
2926
import qualified Data.Map as Map
3027
import Data.Text(Text)
@@ -69,9 +66,6 @@ instance Semigroup HStoreBuilder where
6966

7067
instance Monoid HStoreBuilder where
7168
mempty = Empty
72-
#if !(MIN_VERSION_base(4,11,0))
73-
mappend = (<>)
74-
#endif
7569

7670
class ToHStoreText a where
7771
toHStoreText :: a -> HStoreText

src/Database/PostgreSQL/Simple/Internal.hs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import Data.Int (Int64)
3434
import qualified Data.IntMap as IntMap
3535
import Data.IORef
3636
import Data.Maybe(fromMaybe)
37-
import Data.Monoid
3837
import Data.String
3938
import qualified Data.Text as T
4039
import qualified Data.Text.Encoding as TE
@@ -490,9 +489,6 @@ instance Alternative Conversion where
490489
Errors _ -> (oka <|>) <$> runConversion mb conn
491490

492491
instance 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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

0 commit comments

Comments
 (0)