packages feed

hpqtypes-1.15.0.0: CHANGELOG.md

# hpqtypes-1.15.0.0 (2026-09-28)
* The thread that starts a DB session now owns it. If another thread uses the
  session, the library throws `ThreadMismatchError` wrapped in `DBException`.
  Previously, threads shared the session, including its connection and its
  transaction. This change affects all threads that get the session from a
  fork, e.g. the threads of `race` and `concurrently` from `lifted-async`. To
  run queries in another thread, call `withNewSession` in that thread.
* Rename `withNewConnection` to `withNewSession`, because the new session does
  not always acquire a connection immediately. Replace each use of
  `withNewConnection` with `withNewSession`.
* Fix two bugs of `withNewSession` (`withNewConnection` in earlier versions)
  in a forked thread. If the parent session ended first, the function failed
  with the error `finalized connection`. While the parent session ran a query,
  the function waited for the query to finish.
* Fix a use-after-free of the buffer that holds the connection string in
  `connect`. If an asynchronous exception interrupted `connect`, the
  use-after-free was possible.
* Execution of a `COPY` statement now throws an error that says the statement
  is not supported. Previously the library silently reported success and left
  the connection in copy mode until the next query.
* Fix transaction restart handling. A restarted transaction no longer runs
  with asynchronous exceptions masked. An asynchronous exception, e.g. a
  timeout, no longer triggers a restart. A restart predicate that matches
  it makes no difference. If a transaction fails, a subsequent failure of
  its cleanup no longer masks the original exception. Previously this hid
  the exception from the restart predicate.
* Fix a bug in the on demand connection acquisition mode. If a query left
  the connection in a state that admits no further queries, e.g. because the
  connection died, the `ROLLBACK` that ended the automatic transaction of the
  query failed. Its failure masked the exception thrown from the query.
* Fix a bug in `withSavepoint`. If the action threw and the cleanup of the
  savepoint failed as well, e.g. because the connection died, the failure of
  the cleanup masked the exception of the action.
* Fix a bug in `unsafeWithoutTransaction`. If the action threw and the `BEGIN`
  that restores the transaction failed as well, e.g. because the connection
  died, the failure of the `BEGIN` masked the exception of the action.
* Row fetching functions no longer decode all rows of the result up front
  and retain them until the fold completes. They decode each row right
  before the fold function consumes it. As a result, e.g. `mapDB_` over a
  large result runs in constant additional memory.
* Add `FromSQL` and `ToSQL` instances for `Word16`, `Word32` and `Word64`.
* Add `FromSQL` and `ToSQL` instances for `Integer`, mapped to `numeric`.
* `JSON` and `JSONB` now serialize and deserialize the wrapped type with its
  `ToJSON` and `FromJSON` instances. They work for any such type and support
  `deriving via`, e.g. `deriving (PQFormat, ToSQL, FromSQL) via JSONB Config`.
  The `aesonFromSQL` and `aesonToSQL` helpers are gone. The instances for
  unparsed JSON text moved to the dedicated `RawJSON` and `RawJSONB` types,
  which wrap a strict `ByteString`. The instances for lazy `ByteString` are
  gone. The `encodeRawJSON` and `encodeRawJSONB` functions build these types
  from any type with a `ToJSON` instance. The `decodeRawJSON` and
  `decodeRawJSONB` functions convert back and return `Nothing` on a failure.
  The `eitherDecodeRawJSON` and `eitherDecodeRawJSONB` functions return the
  reason for the failure instead.
* Fix a bug in `changeAcquisitionModeTo`. If the commit of a transaction
  failed during the transition from the `AcquireAndHold` to the
  `AcquireOnDemand` mode, the library held on to an invalid connection
  object.
* Fix a bug in `withCursor`. If the enclosing transaction was in the aborted
  state, the failure of the cursor cleanup masked an exception thrown from
  the continuation. In particular, this prevented restarts of transactions
  run with a `RestartPredicate`.
* Fix a bug in `commit`, `rollback` and `unsafeWithoutTransaction`. If the
  issued `COMMIT` failed, e.g. because of a deferred constraint violation,
  the session stayed in the autocommit mode instead of starting a new
  transaction.
* Fix a bug in `withCursor` where an asynchronous exception cancelled the
  `CLOSE` query and left the cursor open.
* Fix a bug in `withSavepoint` where an asynchronous exception cancelled the
  `ROLLBACK TO SAVEPOINT` or `RELEASE SAVEPOINT` query. The savepoint stayed in
  place, or the transaction stayed in the aborted state.

# hpqtypes-1.14.0.0 (2025-12-10)
* Make `begin`, `commit` and `rollback` do nothing instead of throwing an error
  if the on demand connection acquisition mode is active.

# hpqtypes-1.13.0.1 (2025-11-27)
* Fix a bug in `initConnectionState` and `finalizeConnectionState` that could
  lead to leaking connections.

# hpqtypes-1.13.0.0 (2025-11-26)
* Drop support for GHC < 9.2.
* Include time spent executing queries in `ConnectionStats`.
* Add `initialConnectionStats`.
* Introduce on-demand connection acquisition mode.

# hpqtypes-1.12.0.0 (2024-03-18)
* Drop support for GHC 8.8.
* Attach `CallStack` and `BackendPid` to `DBException`.
* Add `getBackendPid` to `MonadDB` for getting the ID of the server process
  attached to the current session.

# hpqtypes-1.11.1.2 (2023-11-08)
* Support multihost setups and the `connect_timeout` parameter in the connection
  string.

# hpqtypes-1.11.1.1 (2023-03-14)
* Add support for GHC 9.6.

# hpqtypes-1.11.1.0 (2023-01-31)
* Add support for setting a custom role when establishing a connection.

# hpqtypes-1.11.0.0 (2023-01-18)
* Require `resource-pool` >= 0.4 and adjust the `createPool` function to
  seamlessly accommodate future changes to the `resource-pool` library.

# hpqtypes-1.10.0.2 (2022-10-12)
* Simplify Setup.

# hpqtypes-1.10.0.1 (2022-09-23)
* Provide detailed error when `openConnection` fails.

# hpqtypes-1.10.0.0 (2022-09-14)
* Improve `Show` instances of `HPQTypesError` and `LibPQError`.
* Remove `INLINE` and `INLINABLE` pragmas.
* Fix a rare bug in the `connect` function related to file descriptors.
* Add support for GHC 9.4.
* Require `resource-pool >= 0.3` (changes type signature of `poolSource`).

# hpqtypes-1.9.4.0 (2022-05-18)
* Add support for prepared statements.
* Make more foreign C calls safe.
* Don't manage `PGconn` with a `ForeignPtr`.
* Use `closeFdWith` when closing connections.

# hpqtypes-1.9.3.1 (2022-03-30)
* Fix `withTransaction` and `withSavepoint` with short-circuiting monad
  transformers such as `ExceptT`.

# hpqtypes-1.9.3.0 (2022-02-25)
* Fix support for M1 chips.
* Add support for aeson >= 2.0.
* Add support for GHC 9.2.
* Drop support for GHC < 8.8.

# hpqtypes-1.9.2.1 (2021-11-04)
* Improve an SQL query that gets information about composite types.

# hpqtypes-1.9.2.0 (2021-09-29)
* Add method withFrozenLastQuery to (temporarily) stop recording queries.

# hpqtypes-1.9.1.2 (2021-07-29)
* Fix compilation issues caused by ambiguos occurence of `controlT`.

# hpqtypes-1.9.1.1 (2021-05-27)
* Support GHC 9.0.

# hpqtypes-1.9.1.0 (2020-09-14)
* Expose aesonFromSQL and aesonToSQL for convenience.

# hpqtypes-1.9.0.1 (2020-09-04)
* Remove upper bounds of dependencies.

# hpqtypes-1.9.0.0 (2020-04-02)
* Support GHC 8.8 and 8.10.

# hpqtypes-1.8.0.1 (2020-02-06)
* Make poolSource work properly with shortcircuiting monad transformers.

# hpqtypes-1.8.0.0 (2019-10-31)
* Implement `UUID` format ([#17](https://github.com/scrive/hpqtypes/pull/17)).
* Support GHC 8.8.

# hpqtypes-1.7.0.0 (2019-05-21)
* Remove the `Default` instances for `ConnectionSettings` and
  `TransactionSettings`; use `defaultConnectionSettings` and
  `defaultTransactionsettings` instead
  ([#15](https://github.com/scrive/hpqtypes/pull/15)).

# hpqtypes-1.6.1.0 (2018-11-24)
* Add support for cursors
  ([#13](https://github.com/scrive/hpqtypes/pull/13)).
* Remove explicit `deriving Typeable` from all data types.

# hpqtypes-1.6.0.0 (2018-07-11)
* Convert the `PQFormat` class to use `TypeApplications` instead of an
  `undefined :: t` argument
  ([#11](https://github.com/scrive/hpqtypes/pull/11)).
* Support GHC 8.6.
* Drop support for GHC < 8.

# hpqtypes-1.5.3.0 (2018-06-04)
* Add INLINE/INLINEABLE pragmas for call site specialization.
* Remove -O2 -funbox-strict-fields from ghc-options.
* Make query execution interruptible with asynchronous exceptions.
* Make connect interruptible with asynchronous exceptions.

# 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.
* Fix compilation with 'cabal new-build' and Cabal < 1.24.

# hpqtypes-1.5.1 (2016-07-04)
* Do not use linux/limits.h.

# hpqtypes-1.5.0 (2016-06-21)
* Remove orphan MonadDB instances.
* Turn ConnectionSource into indexed datatype.
* Remove Binary wrapper and (de)serialize ByteString as bytes.
* Use Text instead of ByteString where appropriate.
* Use UTF-8 client encoding by default for compatibility with Text.

# hpqtypes-1.4.5 (2016-05-30)
* Fix compilation with Cabal 1.24 and GHC 8.0.1.

# hpqtypes-1.4.4 (2016-01-19)
* Fix lower bound of base version.

# hpqtypes-1.4.3 (2015-10-09)
* Remove invalid FromSQL ZonedTime instance.

# hpqtypes-1.4.2 (2015-06-08)
* Use strict StateT for DBT.
* Use catch in withTransaction only if it might be used.

# hpqtypes-1.4.1 (2015-05-15)
* Add support for json and jsonb sql types.
* Add support for lazy ByteString and Text.

# hpqtypes-1.4.0 (2015-02-26)
* Add support for QuickCheck 2.7.
* Add support for notifications.
* Remove SpaceMonoid, use Monoid and IsString instead.
* Use data-default-class package for default values.
* Drop Single, use Identity functor instead.
* Remove someSQL from IsSQL class.
* Remove foldlM/foldrM from MonadDB and make QueryResult instance of Foldable instead.
* Add support for a type representing cartesian product of rows for more composability.
* Do not wrap exceptions thrown from DBT in DBException unless explicitly requested.
* Provide custom Show instance for Interval.
* Add ToSQL instance for Int.

# hpqtypes-1.3.2 (2015-01-27)
* Replace wrong package uploaded to hackage.

# hpqtypes-1.3.1 (2015-01-26)
* Add support for XML type.

# hpqtypes-1.3.0 (2015-01-09)
* Composite: make {from,to}Composite functions pure.

# hpqtypes-1.2.5 (2015-01-04)
* Add support for monad-control >= 1.0.0.1.

# hpqtypes-1.2.4 (2014-12-08)
* Add IsString instance for Savepoint newtype.