diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,6 @@
+# hpqtypes-1.5.2.0 (2018-03-18)
+* support GHC 8.4.1
+
 # hpqtypes-1.5.1.1 (2016-09-22)
 * fix test suite compilation with GHC 8
 * fix lower bound of base version
diff --git a/hpqtypes.cabal b/hpqtypes.cabal
--- a/hpqtypes.cabal
+++ b/hpqtypes.cabal
@@ -1,5 +1,5 @@
 name:                hpqtypes
-version:             1.5.1.1
+version:             1.5.2.0
 synopsis:            Haskell bindings to libpqtypes
 
 description:         Efficient and easy-to-use bindings to (slightly modified)
@@ -10,30 +10,35 @@
                      along with the bindings. The differences between verbatim
                      libpqtypes and the one used by this package:
                      .
-                     * per-thread global error structures were replaced by explicit
-                       passing of these structures around so that there is no need
-                       to use bound threads.
+                     * per-thread global error structures were replaced by
+                       explicit passing of these structures around so that
+                       there is no need to use bound threads.
                      .
                      * handlers that take values to be put into the database were
                        modified to always expect pointers to objects, as opposed
                        to previous situation where primitives were being taken by
-                       value (which was convenient if the library was used directly
-                       from C, but created inconsistency problems while trying to
-                       define bindings in a sensible way).
+                       value (which was convenient if the library was used
+                       directly from C, but created inconsistency problems
+                       while trying to define bindings in a sensible way).
                      .
-                     Examples can be found in the <https://github.com/scrive/hpqtypes/tree/master/examples examples> directory.
+                     Examples can be found in the
+                     <https://github.com/scrive/hpqtypes/tree/master/examples examples>
+                     directory.
 
 homepage:            https://github.com/scrive/hpqtypes
 license:             BSD3
 license-file:        LICENSE
 author:              Scrive AB
-maintainer:          Andrzej Rybczak <andrzej@rybczak.net>, Jonathan Jouty <jonathan@scrive.com>, Mikhail Glushenkov <mikhail@scrive.com>
+maintainer:          Andrzej Rybczak <andrzej@rybczak.net>,
+                     Jonathan Jouty <jonathan@scrive.com>,
+                     Mikhail Glushenkov <mikhail@scrive.com>
 copyright:           Scrive AB
 category:            Database
 build-type:          Custom
 cabal-version:       >= 1.18
-tested-with:         GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1
+tested-with:         GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.1, GHC == 8.2.2, GHC == 8.4.1
 
+
 extra-source-files: README.md
                   , CHANGELOG.md
                   , examples/Catalog.hs
@@ -61,10 +66,21 @@
                   , libpqtypes/src/libpqtypes-int.h
                   , libpqtypes/src/libpqtypes.h
 
-Source-repository head
-  Type:     git
-  Location: git@github.com:scrive/log.git
+custom-setup
+  setup-depends: base >= 4.7 && < 4.12,
+                 Cabal >= 1.24 && < 2.3,
+                 directory,
+                 filepath
 
+source-repository head
+  type:     git
+  location: https://github.com/scrive/hpqtypes.git
+
+source-repository this
+  type:     git
+  location: https://github.com/scrive/hpqtypes.git
+  tag:      1.5.2.0
+
 library
   exposed-modules:     Data.Monoid.Utils
                      , Database.PostgreSQL.PQTypes
@@ -103,10 +119,11 @@
                      , Database.PostgreSQL.PQTypes.Internal.C.Interface
                      , Database.PostgreSQL.PQTypes.Internal.C.Get
 
-  build-depends:       base >= 4.7 && < 5
+  build-depends:       base >= 4.7 && < 4.12
                      , text >= 0.11
                      , aeson >= 0.6.2.0
                      , bytestring >= 0.9
+                     , semigroups >= 0.16
                      , time >= 1.4
                      , vector >= 0.10
                      , transformers-base >= 0.4
@@ -118,7 +135,7 @@
                      , containers >= 0.4.0.0
                      , exceptions >= 0.6
                      , data-default-class
-                     , text-show
+                     , text-show >= 2
 
   hs-source-dirs:    src
 
@@ -183,24 +200,24 @@
                      Test.QuickCheck.Arbitrary.Instances
   build-depends:       hpqtypes
                      , base >= 4.7 && < 5
-                     , text >= 0.11
+                     , HUnit >= 1.2
+                     , QuickCheck >= 2.5
                      , aeson >= 0.6.2.0
                      , bytestring >= 0.9
-                     , time >= 1.4
-                     , transformers-base >= 0.4
-                     , monad-control >= 0.3
+                     , exceptions >= 0.6
                      , lifted-base >= 0.2
+                     , monad-control >= 0.3
                      , mtl >= 2.1
-                     , QuickCheck >= 2.5
-                     , HUnit >= 1.2
-                     , test-framework >= 0.8
-                     , test-framework-hunit >= 0.3
                      , random >= 1.0
-                     , exceptions >= 0.6
                      , scientific
+                     , test-framework >= 0.8
+                     , test-framework-hunit >= 0.3
+                     , text >= 0.11
+                     , text-show
+                     , time >= 1.4
+                     , transformers-base >= 0.4
                      , unordered-containers
                      , vector
-                     , text-show
 
   default-language:  Haskell2010
   default-extensions: BangPatterns
diff --git a/src/Database/PostgreSQL/PQTypes/Internal/Connection.hs b/src/Database/PostgreSQL/PQTypes/Internal/Connection.hs
--- a/src/Database/PostgreSQL/PQTypes/Internal/Connection.hs
+++ b/src/Database/PostgreSQL/PQTypes/Internal/Connection.hs
@@ -117,7 +117,7 @@
   unConnectionSource :: forall m. MkConstraint m cs => ConnectionSourceM m
 }
 
--- | Default connection supplier. It estabilishes new
+-- | Default connection supplier. It establishes new
 -- database connection each time 'withConnection' is called.
 simpleSource
   :: ConnectionSettings
@@ -127,7 +127,7 @@
 }
 
 -- | Pooled source. It uses striped pool from resource-pool
--- package to cache estabilished connections and reuse them.
+-- package to cache established connections and reuse them.
 poolSource
   :: ConnectionSettings
   -> Int -- ^ Stripe count. The number of distinct sub-pools
diff --git a/src/Database/PostgreSQL/PQTypes/Interval.hsc b/src/Database/PostgreSQL/PQTypes/Interval.hsc
--- a/src/Database/PostgreSQL/PQTypes/Interval.hsc
+++ b/src/Database/PostgreSQL/PQTypes/Interval.hsc
@@ -17,6 +17,7 @@
 import Foreign.Storable
 import Prelude
 import qualified Data.ByteString.Char8 as BS
+import qualified Data.Semigroup as SG
 
 import Database.PostgreSQL.PQTypes.Format
 import Database.PostgreSQL.PQTypes.FromSQL
@@ -56,9 +57,8 @@
         1 -> show n ++ " " ++ desc
         _ -> show n ++ " " ++ desc ++ "s"
 
-instance Monoid Interval where
-  mempty = Interval 0 0 0 0 0 0 0
-  mappend a b = Interval {
+instance SG.Semigroup Interval where
+  a <> b = Interval {
     intYears = intYears a + intYears b
   , intMonths = intMonths a + intMonths b
   , intDays = intDays a + intDays b
@@ -67,6 +67,10 @@
   , intSeconds = intSeconds a + intSeconds b
   , intMicroseconds = intMicroseconds a + intMicroseconds b
   }
+
+instance Monoid Interval where
+  mempty  = Interval 0 0 0 0 0 0 0
+  mappend = (SG.<>)
 
 instance Storable Interval where
   sizeOf _ = #{size PGinterval}
diff --git a/src/Database/PostgreSQL/PQTypes/SQL.hs b/src/Database/PostgreSQL/PQTypes/SQL.hs
--- a/src/Database/PostgreSQL/PQTypes/SQL.hs
+++ b/src/Database/PostgreSQL/PQTypes/SQL.hs
@@ -16,6 +16,7 @@
 import qualified Data.ByteString.Char8 as BS
 import qualified Data.ByteString.Unsafe as BS
 import qualified Data.Foldable as F
+import qualified Data.Semigroup as SG
 import qualified Data.Sequence as S
 import qualified Data.Text as T
 import qualified Data.Text.Encoding as T
@@ -58,9 +59,12 @@
             verifyPQTRes err "withSQL (SQL)" =<< c_PQputf1 param err fmt base
             modifyMVar nums $ \n -> return . (, "$" <> showt n) $! n+1
 
+instance SG.Semigroup SQL where
+  SQL a <> SQL b = SQL (a S.>< b)
+
 instance Monoid SQL where
   mempty = mkSQL T.empty
-  SQL a `mappend` SQL b = SQL (a S.>< b)
+  mappend = (SG.<>)
 
 instance Show SQL where
   showsPrec n sql = ("SQL " ++) . (showsPrec n . concatMap conv . unSQL $ sql)
diff --git a/src/Database/PostgreSQL/PQTypes/SQL/Raw.hs b/src/Database/PostgreSQL/PQTypes/SQL/Raw.hs
--- a/src/Database/PostgreSQL/PQTypes/SQL/Raw.hs
+++ b/src/Database/PostgreSQL/PQTypes/SQL/Raw.hs
@@ -9,6 +9,7 @@
 import Foreign.Marshal.Alloc
 import Prelude
 import qualified Data.ByteString.Char8 as BS
+import qualified Data.Semigroup as SG
 import qualified Data.Text as T
 import qualified Data.Text.Encoding as T
 
@@ -32,10 +33,14 @@
 instance IsString (RawSQL ()) where
   fromString = flip RawSQL () . T.pack
 
+instance SG.Semigroup (RawSQL ()) where
+  RawSQL a () <> RawSQL b () = RawSQL (a <> b) ()
+  sconcat xs = RawSQL (SG.sconcat $ fmap (\(RawSQL s ()) -> s) xs) ()
+
 instance Monoid (RawSQL ()) where
   mempty = rawSQL T.empty ()
-  RawSQL a () `mappend` RawSQL b () = RawSQL (a `mappend` b) ()
-  mconcat xs = RawSQL (T.concat $ map (\(RawSQL s ()) -> s) xs) ()
+  mappend = (SG.<>)
+  mconcat xs = RawSQL (mconcat $ fmap (\(RawSQL s ()) -> s) xs) ()
 
 -- | Construct 'RawSQL' from 'Text' and a tuple of parameters.
 rawSQL :: (Show row, ToRow row) => T.Text -> row -> RawSQL row
diff --git a/test/Main.hs b/test/Main.hs
--- a/test/Main.hs
+++ b/test/Main.hs
@@ -10,6 +10,7 @@
 import Control.Monad.State
 import Control.Monad.Trans.Control
 import Data.Aeson
+import Data.Char
 import Data.Int
 import Data.Maybe
 import Data.Time
@@ -72,6 +73,23 @@
 
 ----------------------------------------
 
+newtype AsciiChar = AsciiChar { unAsciiChar :: Char }
+  deriving (Eq, Show, Typeable, PQFormat)
+
+instance ToSQL AsciiChar where
+  type PQDest AsciiChar = PQDest Char
+  toSQL = toSQL . unAsciiChar
+
+instance FromSQL AsciiChar where
+  type PQBase AsciiChar = PQBase Char
+  fromSQL = fmap AsciiChar . fromSQL
+
+instance Arbitrary AsciiChar where
+  -- QuickCheck >= 2.10 changed Arbitrary Char instance to include proper
+  -- Unicode CharS, but PostgreSQL only accepts ASCII ones.
+  arbitrary = AsciiChar . chr <$> oneof [choose (0,127), choose (0,255)]
+  shrink    = map AsciiChar . shrink . unAsciiChar
+
 instance Arbitrary Interval where
   arbitrary = Interval
     <$> abs `fmap` arbitrary
@@ -348,7 +366,7 @@
   , nullTest td (u::Float)
   , nullTest td (u::Double)
   , nullTest td (u::Bool)
-  , nullTest td (u::Char)
+  , nullTest td (u::AsciiChar)
   , nullTest td (u::Word8)
   , nullTest td (u::String)
   , nullTest td (u::BS.ByteString)
@@ -373,7 +391,7 @@
   , putGetTest td 10000 (u::Float) (==)
   , putGetTest td 10000 (u::Double) (==)
   , putGetTest td 100 (u::Bool) (==)
-  , putGetTest td 100 (u::Char) (==)
+  , putGetTest td 100 (u::AsciiChar) (==)
   , putGetTest td 100 (u::Word8) (==)
   , putGetTest td 1000 (u::String0) (==)
   , putGetTest td 1000 (u::BS.ByteString) (==)
@@ -399,56 +417,56 @@
   , rowTest td (u::Identity Int16)
   , rowTest td (u::Identity T.Text :*: (Double, Int16))
   , rowTest td (u::(T.Text, Double) :*: Identity Int16)
-  , rowTest td (u::(Int16, T.Text, Int64, Double) :*: Identity Bool :*: (String0, Char))
+  , rowTest td (u::(Int16, T.Text, Int64, Double) :*: Identity Bool :*: (String0, AsciiChar))
   , rowTest td (u::(Int16, Int32))
   , rowTest td (u::(Int16, Int32, Int64))
   , rowTest td (u::(Int16, Int32, Int64, Float))
   , rowTest td (u::(Int16, Int32, Int64, Float, Double))
   , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day))
-  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, Char, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day))
+  , rowTest td (u::(Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32, Composite Simple, CompositeArray1 Simple, Composite Nested, CompositeArray1 Nested, Int16, Int32, Int64, Float, Double, Bool, AsciiChar, Word8, String0, BS.ByteString, T.Text, BS.ByteString, Day, Array1 Int32))
   ]
   where
     u = undefined
@@ -469,24 +487,36 @@
   runSQL_ "DROP TYPE simple_"
   runSQL_ "DROP TABLE test1_"
 
-main :: IO ()
-main = do
+getConnString :: IO (T.Text, [String])
+getConnString = do
   args <- getArgs
-  when (null args) $ do
-    prog <- getProgName
-    putStrLn $ "Usage:" <+> prog <+> "<connection info string> [test-framework args]"
-    exitFailure
+  if (null args) then
+    do isTravis <- maybe False ((==) "true") <$> lookupEnv "TRAVIS"
+       if isTravis
+         then return ("postgresql://postgres@localhost/travis_ci_test", [])
+         else do printUsage
+                 exitFailure
+    else return $ (T.pack . head $ args, tail args)
+  where
+    printUsage = do
+      prog <- getProgName
+      putStrLn $ "Usage:" <+> prog
+        <+> "<connection info string> [test-framework args]"
 
+main :: IO ()
+main = do
+  (connString, args) <- getConnString
   let connSettings = def {
-          csConnInfo = T.pack $ head args
+          csConnInfo       = connString
         , csClientEncoding = Just "latin1"
         }
       ConnectionSource connSource = simpleSource connSettings
 
   createStructures connSource
-  ConnectionSource connPool <- poolSource (connSettings { csComposites = ["simple_", "nested_"] }) 1 30 16
+  ConnectionSource connPool <-
+    poolSource (connSettings { csComposites = ["simple_", "nested_"] }) 1 30 16
   gen <- newQCGen
   putStrLn $ "PRNG:" <+> show gen
 
-  finally (defaultMainWithArgs (tests (gen, connPool)) $ tail args) $ do
+  finally (defaultMainWithArgs (tests (gen, connPool)) $ args) $ do
     dropStructures connSource
