hasql 1.10.2.3 → 1.10.2.4
raw patch · 10 files changed
+26/−51 lines, 10 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +0/−2
- hasql.cabal +2/−2
- src/comms-tests/Hasql/Comms/SpecHook.hs +2/−2
- src/library-tests/Isolated/ByUnit/Connection/AcquireSpec.hs +9/−33
- src/library-tests/Sharing/ByFeature/DecoderCompatibilityCheckSpec.hs +4/−3
- src/library-tests/Sharing/ByUnit/Session/ScriptSpec.hs +3/−3
- src/library-tests/Sharing/SpecHook.hs +2/−2
- src/library/Hasql/Connection.hs +1/−1
- src/library/Hasql/Connection/ServerVersion.hs +2/−2
- src/profiling/Main.hs +1/−1
CHANGELOG.md view
@@ -41,8 +41,6 @@ - Decoder checks are now more strict and report `UnexpectedColumnTypeStatementError` when the actual type of a column does not match the expected type of the decoder. Previously such mismatches were silently ignored and could lead to either autocasts or runtime errors in later stages. - E.g., `int4` column decoded with `int8` decoder will now report `UnexpectedColumnTypeStatementError` instead of silently accepting the value. -- Due to the above the oldest supported PostgreSQL version now is 10. In older versions some types had different OIDs.- - Session now has exclusive access to the connection for its entire duration. Previously it was releasing and reacquiring the lock on the connection between statements. - If you need the old behaviour, you can use `ReaderT Connection (ExceptT SessionError IO)`.
hasql.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: hasql-version: 1.10.2.3+version: 1.10.2.4 category: Hasql, Database, PostgreSQL synopsis: Fast PostgreSQL driver with a flexible mapping API description:@@ -17,7 +17,7 @@ so typically all you need is just to install the latest PostgreSQL distro. Despite the mentioned requirements for \"libpq\" \"hasql\" is thoroughly tested to be compatible- with a wide range of PostgreSQL servers starting from version 10.+ with a wide range of PostgreSQL servers starting from version 9. homepage: https://github.com/nikita-volkov/hasql bug-reports: https://github.com/nikita-volkov/hasql/issues
src/comms-tests/Hasql/Comms/SpecHook.hs view
@@ -9,8 +9,8 @@ hook :: HookedSpec -> Spec hook hookedSpec = parallel do- byDistro "postgres:10"- byDistro "postgres:17"+ byDistro "postgres:9"+ byDistro "postgres:18" where byDistro tagName = describe (toList tagName) do
src/library-tests/Isolated/ByUnit/Connection/AcquireSpec.hs view
@@ -27,34 +27,10 @@ expectationFailure ("Expected NetworkingConnectionError, but got: " <> show err) describe "postgres:9" do- it "Fails with compatibility error" do- TestcontainersPostgresql.run- TestcontainersPostgresql.Config- { tagName = "postgres:9",- auth = TestcontainersPostgresql.CredentialsAuth "postgres" "postgres",- forwardLogs = False- }- \(host, port) -> do- let settings =- mconcat- [ Settings.hostAndPort host port,- Settings.user "postgres",- Settings.password "postgres",- Settings.dbname "postgres"- ]- result <- Connection.acquire settings- case result of- Right conn -> do- Connection.release conn- expectationFailure "Expected connection to fail with compatibility error, but it succeeded"- Left err ->- err `shouldBe` Errors.CompatibilityConnectionError "Server version is lower than 10: 9.6.24"-- describe "postgres:10" do it "Succeeds" do TestcontainersPostgresql.run TestcontainersPostgresql.Config- { tagName = "postgres:10",+ { tagName = "postgres:9", auth = TestcontainersPostgresql.CredentialsAuth "postgres" "postgres", forwardLogs = False }@@ -73,11 +49,11 @@ Left err -> do expectationFailure ("Expected connection to succeed, but it failed with error: " <> show err) - describe "postgres:17" do+ describe "postgres:18" do it "Succeeds" do TestcontainersPostgresql.run TestcontainersPostgresql.Config- { tagName = "postgres:17",+ { tagName = "postgres:18", auth = TestcontainersPostgresql.CredentialsAuth "postgres" "postgres", forwardLogs = False }@@ -99,7 +75,7 @@ it "Fails with authentication error on incorrect password" do TestcontainersPostgresql.run TestcontainersPostgresql.Config- { tagName = "postgres:17",+ { tagName = "postgres:18", auth = TestcontainersPostgresql.CredentialsAuth "postgres" "postgres", forwardLogs = False }@@ -124,7 +100,7 @@ it "Fails with authentication error on incorrect user" do TestcontainersPostgresql.run TestcontainersPostgresql.Config- { tagName = "postgres:17",+ { tagName = "postgres:18", auth = TestcontainersPostgresql.CredentialsAuth "postgres" "postgres", forwardLogs = False }@@ -146,11 +122,11 @@ Left err -> expectationFailure ("Expected AuthenticationConnectionError, but got: " <> show err) - describe "postgres:10" do- byDistro "postgres:10"+ describe "postgres:9" do+ byDistro "postgres:9" - describe "postgres:17" do- byDistro "postgres:17"+ describe "postgres:18" do+ byDistro "postgres:18" byDistro :: Text -> Spec byDistro tagName = do
src/library-tests/Sharing/ByFeature/DecoderCompatibilityCheckSpec.hs view
@@ -73,7 +73,7 @@ Scripts.onPreparableConnection config \connection -> do let statement = (if preparable then Statement.preparable else Statement.unpreparable)- "select 1::int8, 'text'"+ "select 1::int8, 'text'::text" mempty ( Decoders.singleRow ( (,)@@ -85,7 +85,8 @@ case result of Left (Errors.StatementSessionError _ _ _ _ _ (Errors.UnexpectedColumnTypeStatementError column expected actual)) -> do shouldBe column 1- (expected, actual) `shouldBe` (20, 25)+ shouldBe expected 20+ shouldBe actual 25 Left err -> expectationFailure ("Unexpected type of error: " <> show err) result ->@@ -96,7 +97,7 @@ Scripts.onPreparableConnection config \connection -> do let statement = (if preparable then Statement.preparable else Statement.unpreparable)- "select 1::int8, 'text'"+ "select 1::int8, 'text'::text" mempty ( Decoders.rowMaybe ( (,)
src/library-tests/Sharing/ByUnit/Session/ScriptSpec.hs view
@@ -23,17 +23,17 @@ let sql = (mconcat . map (<> "\n")) [ "create table \"" <> tableName <> "_genre\" (",- " \"id\" int4 not null generated always as identity primary key,",+ " \"id\" int4 not null primary key,", " \"name\" text not null unique", ");", "", "create table \"" <> tableName <> "_artist\" (",- " \"id\" int4 not null generated always as identity primary key,",+ " \"id\" int4 not null primary key,", " \"name\" text not null", ");", "", "create table \"" <> tableName <> "_album\" (",- " \"id\" int4 not null generated always as identity primary key,",+ " \"id\" int4 not null primary key,", " -- Album name.", " \"name\" text not null,", " -- The date the album was first released.",
src/library-tests/Sharing/SpecHook.hs view
@@ -9,8 +9,8 @@ hook :: HookedSpec -> Spec hook hookedSpec = parallel do- byDistro "postgres:10"- byDistro "postgres:17"+ byDistro "postgres:9"+ byDistro "postgres:18" where byDistro tagName = describe (toList tagName) do
src/library/Hasql/Connection.hs view
@@ -49,7 +49,7 @@ -- Check version: version <- lift (ServerVersion.load pqConnection) when (version < ServerVersion.minimum) do- throwError (CompatibilityConnectionError ("Server version is lower than 10: " <> ServerVersion.toText version))+ throwError (CompatibilityConnectionError ("Server version is lower than 9: " <> ServerVersion.toText version)) -- Initialize: lift do
src/library/Hasql/Connection/ServerVersion.hs view
@@ -32,7 +32,7 @@ -- >>> fromInt 90200 -- ServerVersion 9 2 0 ----- Ref: https://www.postgresql.org/docs/17/libpq-status.html#LIBPQ-PQSERVERVERSION+-- Ref: https://www.postgresql.org/docs/18/libpq-status.html#LIBPQ-PQSERVERVERSION fromInt :: Int -> ServerVersion fromInt x = if x < 100_000@@ -63,7 +63,7 @@ -- | Minimum supported version. minimum :: ServerVersion-minimum = ServerVersion 10 0 0+minimum = ServerVersion 9 0 0 -- | Load from PQ connection. load :: Pq.Connection -> IO ServerVersion
src/profiling/Main.hs view
@@ -89,7 +89,7 @@ -- * Testcontainers withConnection :: (Connection.Connection -> IO ()) -> IO ()-withConnection = withConnectionByTagName "postgres:17"+withConnection = withConnectionByTagName "postgres:18" withConnectionByTagName :: Text -> (Connection.Connection -> IO ()) -> IO () withConnectionByTagName tagName action = withConnectionSettings tagName \settings -> do