- Remove Eq Null instance. (Future
base
may break it, we remove it profilacticly). - Use
postgresql-libpq >=0.10.0.0
. It includes critical fixes, by usingpostgresql-simple >=0.7
you won't get olderpostgresql-libpq
. - Drop support for GHC prior 8.6
- Added a class for
postgresql-simple
exceptions:SomePostgreSqlException
. This allows to catch allpostgresql-simple
exceptions at once. (c.f.AsyncException
in `base).
- Support
aeson-2.2.0.0
- Add
withConnect
- Add foldCopyData helper function Thanks to Sebastián Estrella for the implementation haskellari#56
- Implement support for postgresql 'interval' type Thanks to Andre Marques Lee for the implementation haskellari#60
- Depend on
time-compat
to provide uniformtime
related interface.
- Add
fromFieldJSONByteString
Thanks to tomjaguarpaw for the implementation haskellari#47 - Add
attoFieldParser
Thanks to Victor Nawothnig for the implementation haskellari#45 - Add
Identity
andConst
instance Thanks to Cary Robbins for the implementation haskellari#46 - Add
withTransactionModeRetry'
, a variant ofwithTransactionModeRetry
for all exception types. Thanks to Elliot Cameron for the implementation haskellari#42 - Fix spurious aborts when retrying transactions Thanks to Elliot Cameron for the implementation haskellari#34
- Add
Database.PostgreSQL.Simple.Newtypes
module withAeson
newtype. haskellari#55
- Define
MonadFail Ok
.
-
Escape double '??' to a literal '? Thanks to Felix Paulusma for the implementation. haskellari#5
-
Mention GHC Generics support in the documentation. Thanks to Gabriel Gonzalez for the implementation. haskellari#6
-
Better error message for "Query resulted in a command response Thanks to Max Amanshauser for the implementation. haskellari#7
-
fromJSONField: Include JSONPath on JSON parse errors Thanks to Simon Hengel for the implementation. haskellari#2
-
No TH in implementation haskellari#4
-
Breaking change: Use
Only
package'sOnly
for a common 1-tuple.Consider a downstream library depending already both on
Only
andpostgresql-simple
package. This library my define aMyClass
with instances forOnly.Only
andPostgreSQL.Only
. As now these types are the same, a library would break. Therefore I consider "merging" types a breaking change.There are two ways for adopting this change in that scenario:
-
Either CPP-guard
PostgreSQL.Only
instance with#if !MIN_VERSION_postgresql_simple(0,6,0) instance MyClass (PostgreSQL.Only a) where ... #endif
-
or simply remove it and add
postgresql-simple >=0.6
lower bound, making sure that there's only singleOnly
.
-
-
Add
ToField
instances for case-insensitive strict and lazy text. Thanks to Max Tagher for the implementation. lpsmith/postgresql-simple#232 -
Add support to CockroachDB. Thanks to Georte Steel. lpsmith/postgresql-simple#245
-
Add Generic ConnectInfo instance Thanks to Dmitry Dzhus. lpsmith/postgresql-simple#235
-
Add
fromFieldRange :: Typeable a => FieldParser a -> FieldParser (PGRange a)
lpsmith/postgresql-simple#221 -
Add
fromFieldJSONByteString :: FieldParser ByteString
https://github.com/lpsmith/postgresql-simple/pull/222/files -
Fix off-by-one error in year builder. Thanks to Nathan Ferris Hunter. lpsmith/postgresql-simple#230
-
Extend ToRow and FromRow to tuples of size 18 Thanks to Bardur Arantsson. lpsmith/postgresql-simple#229
-
Add
Vector
andVector.Unboxed
query
variants. These are more memory efficient (especially, if you anyway will convert to some vector) https://github.com/phadej/1 -
Documentation improvements lpsmith/postgresql-simple#227 lpsmith/postgresql-simple#236
- Support GHC-8.4 (Semigroup/Monoid)
-
Refactored some rudimentary cursor handling code out of the implementation of the fold operators, into a new
Database.PostgreSQL.Simple.Cursor
module, thanks to Bardur Arantsson. -
Made the
FromField
instance forChar
compatible with postgresql'sbpchar
type. Thanks to Ivan Lazar Miljenovic for reporting the issue. -
Added
Show
andEq
instances forNotification
, thanks to Matvey Aksenov. -
Fixed some example code, thanks to Matvey Aksenov.
-
Fixed a problem with using
conversionError
to throw exceptions of typeSomeException
. Previously, the exception would be wrapped in a secondSomeException
dynamic constructor which would cause normal GHC typecase idioms overSomeException
to fail.
-
Bumped the lower bound for
base
to 4.6. Thanks to Herbert Valerio Riedel for reporting the issue. -
Added an
Eq
instance forSqlError
, thanks to Chris Allen -
Fixed a bug where a all-caps
"NULL"
text value inside a postgresql array would get parsed as the SQL null value. Thanks goes to Edgar Gomes and Silk for finding and fixing this mistake. -
Modified
withTransaction
and friends to ignoreIOError
s when attempting to roll back the transaction. This fixes a buggy interaction betweenwithTransaction
and async exceptions (e.g.System.Timeout
) on unix platforms. Thanks goes to Erik Hesselink and Silk for providing the test case that exposed this issue. -
Added the
testTimeout
regression test for the problem above.
-
Significantly improved the error reporting from
Copy.putCopyData
, thanks to Ben Gamari. -
Moved the test suite to use
tasty
, with a big thanks to Ben Gamari. -
Added
FromField.optionalField
, and updated the documentation ofFromField.fromJSONField
, as inspired by an email conversation with Ian Wagner. -
Updated all links in the haddocks to use https, and added a link to the documentation of
connectPostgreSQL
. -
Added a truncated changelog to the source distribution.
-
Implemented the Monad of No Return proposal, future-proofing postgresql-simple against future releases of GHC.
-
Fixed a rare and usually benign race condition where
getNotification
could end up waiting on a newly reallocated file descriptor index, potentially leading to deadlock if the descriptor does not become readable promptly. This fix only applies to GHC 7.8 or later, as it depends onthreadWaitReadSTM
. -
Tweaked the time parsers to accept times of day of the form
hh:mm
, omitting seconds, following changes made to aeson. -
Updated the documentation of the
In
type to point out a gotcha when using the SQL fragment... NOT IN ?
withIn []
. Thanks goes to Simon Michael and Dan Haraj for bringing this issue to my attention.
-
The syntax generated for empty arrays was changed so that postgresql's type inference would work better, thanks to Amit Levy.
-
Further revision and expansion of the new Time documentation.
-
This is a documentation-only release
-
The documentation of the
Time
module has been completely rewritten, and is far longer and more informative. It contains a brief overview of civil time, the semantics of postgresql's time types, and their relation to Haskell's time types via postgresql-simple. -
The documentation of
connectPostgreSQL
has been modified to mention the effects of environment variables on the connection string parameters. -
The documentation of
HStore.Internal
has been unhidden from haddock. -
A typo in example code was fixed courtesy of Levi Notik.
-
Optimized the implementation of the streaming operators to avoid creating intermediate lists of rows, thanks to Timo von Holtz.
-
Added default instances for
ToRow
andFromRow
that depend on Generics, thanks to Alexey Khudyakov. -
Fixed support for bytestring-0.9 and GHC 7.4.
- Fixed a bug when printing a
ZonedTime
with a negative offset that is not a whole number of hours.
-
Removed the deprecated
BuiltinTypes
module. -
Modified the SQL quasiquoter so that it returns a
Query
, not an overloaded string, and so that theOverloadedStrings
language extension is no longer necessary, thanks to Mike Ledger. -
Moved away from
blaze-builder
in favor ofbytestring-builder
. This shouldn't affect very many people, but does reduce the transitive dependencies. -
Rewrote the timestamp printers to use the new
Prim
infrastructure inbytestring-builder
. The new printers should be a fair bit faster. -
Added support for exclusion violations to the
ConstraintViolation
type in the Errors module, thanks to João Cristóvão. -
Moved away from the
uuid
package in favor of theuuid-types
package, thanks to Bardur Arantsson. This shouldn't affect anybody, but does reduce the transitive dependencies. -
Postgresql-simple now explicitly assumes the UTF8 character encoding for communication between the client and server. All database encodings support UTF8 except for Mule Internal Code, the Multilingual Extensions for Emacs. An exception should be raised upon connecting to a database by the backend if the backend cannot accommodate this requirement.
-
Added
Eq
andTypeable
instances forConnection
. -
Added the
foldWith
,forEachWith
, andreturningWith
families of functions courtesy of Travis Staton. -
Support for Ranged types, with thanks to Leonid Onokhov for his contributions.
-
The
FromField
instance for JSON now allows for top-level values that are not objects or arrays, thanks to Sam Rijs. -
The timestamp parsers have been replaced with those now in Aeson. Janne Hellsten adapted the old parsers from postgresql-simple for inclusion in Aeson; Bryan O'Sullivan rewrote those parsers to be faster, with some tweaks contributed by myself. And now to bring the effort full circle, the result has been brought back to postgresql-simple, with some adaptations.
-
Fixed a bug in the typeinfo system where postgresql's
_record
type was being reported as a basic type and not an array type. Thanks to Nickolay Kolev for helping to expose this issue. -
Fixed a bug with the
typeInfo
operator, thanks to Timmy Tofu. In the case of parsing subfields of arrays and composites, it would fetch theTypeInfo
of the array or composite type and not the subtype.
-
Added a blurb about SSL/TLS in the documentation for connectPostgreSQL
-
Moved some functions into the Internal module, courtesy of Aleksey Uimanov.
-
Made the fromField method for PGArray available as pgArrayFieldParser, outside of the typeclass courtesy of Tom Ellis.
-
Fixed a missing OverloadedStrings pragma in the documentation of SqlQQ.
-
Fixed deprecation warnings, courtesy of Simon Hengel.
-
Added support for postgresql's citext type extension via the case-insensitive package.
-
Added the function parseHStoreList to the HStore module.
-
Added support for very old timestamps to UTCTime. Depending on time zone, very old timestamps can be returned with a offset from UTC that contains seconds.
All timezones in the TZ database moved to a time standard offset an integer number of minutes from UTC before 1973, almost all locations moved before 1938, and a solid majority moved before 1921.
ZonedTime assumes offsets are a whole number of minutes, and thus the conversion to ZonedTime does not support these timestamps and will still throw a conversion error.
Note that PostgreSQL's "timestamp with time zone" (or "timestamptz") type is nearly universally misunderstood. For an explanation, see:
https://github.com/lpsmith/postgresql-simple/issues/69
Thanks to Michael Snoyman for his assistance with this issue.
- Added an instance ToField NominalDiffTime.
- Added support for retrieving NaN and ±Infinity floating point values from postgres to the FromField instances for Float, Double, and Rational. The instance for Scientific is unchanged due to the fact it has no way of representing these special values. Thanks goes to Tom Nielsen for reporting the issue.
-
Fixed a rather serious bug that prevented the COPY module from working at all on unix clients since version 0.4.3.0. Thanks goes to Dmitry Dzhus for reporting the issue.
-
Added a regression test for the COPY module to the test suite.
-
Added the jsonb type debuting in PostgreSQL 9.4 to the TypeInfo.Static and Builtin tables, and extended the out-of-box json instances to be compatible with the new type. Thanks to Tobias Florek for the patch.
-
Ported some expanded documentation from mysql-simple, and fixed a documentation typo.
-
connect and exec now use libpq asynchronously on non-Windows platforms. This means we are using threadWaitRead and threadWaitWrite to have GHC's IO manager schedule non-blocking C calls to libpq, instead of using blocking C calls and having the OS kernel do the scheduling. Among other things, this now means that System.Timeout will work with connect and exec on unix platforms.
-
connect and exec now throw IOErrors instead of SQLErrors in some cases. The intention is for SQLErrors to represent an error returned by the server, and to use IOErrors for errors that originate from client-side code. However, this goal isn't perfectly achieved as of yet.
-
This is strictly a documentation release, with no code changes.
-
Fixed several documentation typos, thanks to Chris Allen and remdezx.
-
Expanded the documentation of connectPostgreSQL, including a short overview of common use cases and two new links to the official Postgres documentation about the authentication process.
-
De-emphasized connect and ConnectInfo in favor of connectPostgreSQL.
-
Fixed compatibility with scientific-0.3.*, thanks to Adam Bergmark
-
Improved documentation of the FromField module, as well as the fold, foldWithOptions, executeMany, and returning operators.
-
Fixed bug in Values syntax generation
-
Improved documentation, including examples of multi-row update, a better example for Values, documenting the inaccuracies in reading floating point numbers from the database, and the IsString instance for QualifiedIdentifier.
-
Added ToField and FromField instances for the scientific package
-
Changed the Identifier and QualifiedIdentifier to use Text in order to avoid encoding errors. Technically this requires a major version bump, but let's pretend 0.4.1.0 didn't happen.
-
Removed non-exhaustive cases in the ToField instance for Values, and tweaked error messages.
-
Fixed the parsing of arrays containing null values, courtesy of Francesco Mazzoli
-
Added support for properly escaped identifiers, courtesy of Tobias Florek. See the new Identifier and QualifiedIdentifier types inside Database.PostgreSQL.Simple.Types.
-
Added support for parameterized VALUES expressions. This is more general than executeMany and returning. See the Database.PostgreSQL.Simple.Types.Values data type.
-
Tweaked C preprocessor directive to be more portable
-
Tweaked testsuite for compatibility with aeson-0.7
-
Relaxed dependency on aeson to >= 0.6
-
Update the documentation of
fromField
-
Changed the calling code of
fromField
so that it always sends a copy of the raw data. This should be a small but significant performance bump for most people most of the time; however it may slow down retrieval of large values not converted directly to ByteString, such as large json, hstore, and array values. See commit 8635f8 for more information. -
Added the PGArray type. Thanks to Joey Adams for the suggestion
-
Fixed JSON decoding, which was almost entirely broken up until now, due to bugs in the version of aeson currently available on Hackage. Thanks to Amit Levy for the report.
-
Added FromField instances for IORef, MVar, and IOVector.
-
Added the queryWith function, courtesy of Leonid Onokhov
-
Added the Default type, for representing postgresql's default values
- Removed dependency on hashable
-
Added FromField and ToField instances for the
uuid
package, courtesy of Bas van Dijk. -
Added instance FromRow (Maybe a) for most pre-packaged FromRow instances. See issue #64 for some discussion.
-
Added the fromBinary, fromHStoreMap, and fromHStoreList newtype unwrapper functions, courtesy of Bas van Dijk.
-
Fixed the example code in
FromField
, thanks to Adam Bergmark. -
Added
Notification.getBackendPID
.
- Relaxed the dependency on bytestring-0.10 back to bytestring-0.9, courtesy of Michael Snoyman
-
Added
aeson
as a dependency. -
Added ToField and FromField instances for aeson's JSON.Value type, courtesy of Bas van Dijk.
-
Added toJSONField and fromJSONField helper functions for declaring FromField/ToField JSON instances to other Haskell types, courtesy of Bas van Dijk.
-
Added a FromField instance for (), corresponding to postgresql's void type.
-
Added liftConversion and liftRowParser functions to the Internal module, for lifting IO actions into the respective monads.
-
The SqlError predicates available in the Transaction module are now also exported from the Errors module.
-
Various documentation fixes.
-
Added the json type to BuiltinTypes and TypeInfo.Static, courtesy of Manuel Gómez.
-
Removed the remaining internal dependencies on BuiltinTypes from FromField. Added the TypeInfo.Macro module as a result.
-
Deprecated the BuiltinTypes module, which will be removed several months from now. Fixed the example code in FromField to reflect this change.
-
Added an FromRow instance for Vector, semantically identical to the existing FromRow instance for [], courtesy of Doug Beardsley
-
Reworked the documentation for the Copy module, and tweaked the documentation for the LargeObjects module.
-
Added direct support for COPY IN and COPY OUT, without having to use raw postgresql-libpq calls and postgresql-simple's Internal module.
-
Changed
getNotification
so that it throws a IOError (resource vanished) exception instead of an ErrorCall exception when it fails to fetch the connection's file descriptor from libpq.
- Optimized the definition of
mconcat
in the Monoid instance for the Query type, courtesy of Joey Adams.
getNotification
now works on Windows, albeit using a one-second polling loop, courtesy of Joey Adams.
- Fixed two issues with the fold operator: fold would raise the wrong exception, and gave the database cursor a static name preventing folds from being nested. Thanks to Joey Adams for his work on these issues.
- Added a savepoint abstraction to the Transaction module, courtesy of Joey Adams
- Fixed hstore parser to not unnecessarily reverse the key-value pairs
- Fixed hstore parser to recognize empty hstores, courtesy of Simon Meier
-
Added support for Range and Composite types to the TypeInfo system.
-
Added support for hstore types in the Simple.HStore module.
-
Improved documentation of the FromField module.
- A large chunk of the documentation inside the FromField module had silently failed to render in Haddock.
-
Added support for PostgreSQL's Array Types. Thanks to Jason Dusek for his work on this feature.
-
Added a brand new TypeInfo system that gives FromField instances convenient and efficient access to the pg_type metatable. This replaced the older typename cache, and was necessary to properly support postgres array types. Thanks to Bas van Dijk for his work on this feature.
-
Changed the type of the
fromField
andfromRow
methods to allow a restricted set of IO actions, and stopped pre-calculating the type name of every column. As a result, the type of thetypename
operator changed fromField -> ByteString
toField -> Conversion ByteString
, where Conversion is the new monad that conversion computations run inside. -
Improved the documentation of the FromField module.
-
Added the Database.PostgreSQL.Simple.Errors module, which offers some predicates and functions for interpreting SqlError values, courtesy of Leonid Onokhov.
-
Added a the name of a column and the associated table's object identifier to ResultError exceptions, courtesy of Jeff Chu.
-
Moved most of the more detailed transaction operators into the Database.PostgreSQL.Simple.Transaction module.
-
Changed withTransactionModeRetry to accept a predicate of which SqlErrors to retry, due to the fact that serialization errors can sometimes manifest themselves as constraint violations. Thanks to Oliver Charles for pointing this out and implementing the change.
-
Added simple tests of the fold operator, thanks to Joey Adams.
-
Added simple tests of the array conversion code.
-
Added recognition of -- comments in the quasiquoter, which are now stripped out.
- Fixed the documentation of
In
. Thanks to rekado and dstcruz for pointing this out.
- Added the
withTransactionSerializable
andwithTransactionModeRetry
operators, thanks to Joey Adams.
- Added the
returning
operator, thanks to Jason Dusek
-
Added a ToRow instance for the (:.) type, courtesy of Leonid Onokhov
-
Added the type oid for PostgreSQL's
uuid
type to BuiltinTypes
-
Added the FromRow.fieldWith operator, thanks to Leonid Onokhov
-
Added a type synonym for FieldParser
- Fixed a compatibility problem with PostgreSQL 8.1, which does not allow
clients to set their own value for
standard_conforming_strings
. This connection variable is still set toon
for PostgreSQL 8.2 and later.
-
Removed the conversion from
timestamp
toUTCTime
. Some code will be broken even though it will still compile. -
Renamed a number of data constructors, mostly in the BuiltinTypes module.
-
Exported ToRow/FromRow from Database.PostgreSQL.Simple
- Fix language extensions for compatibility with GHC 7.0
- Fix a wayward dependency on Text.
- Added support for timezones with minutes in their UTC offset.
-
Removed pcre-light dependency, courtesy of Joey Adams.
-
Reworked support for the Time types.
-
The conversion from PostgreSQL's
timestamp
(without time zone) type to Haskell'sUTCTime
type is deprecated and will be removed in 0.2. -
Data.Time.LocalTime
now hasFromField
/ToField
instances. It is now the preferred way of dealing withtimestamp
(without time zone). -
Database.PostgreSQL.Simple.Time
is a new module that offers types that accommodate PostgreSQL's infinities. -
All time-related
FromField
/ToField
instances are now based on new, higher-speed parsers and printers instead of those provided by the time package included in GHC.
-
-
Planned breaking changes for 0.2:
-
Removing the conversion from
timestamp
toUTCTime
. -
Renaming some of the type names in
BuiltinTypes
.
-
-
Made ZonedTime an instance of FromField and ToField
-
Added getNotificationNonBlocking
-
Switched to libpq-based escaping for bytea types; Binary now works with PostgreSQL 8 courtesy of Joey Adams.
-
postgresql-simple now sets standard_conforming_strings to "on". This per-connection variable is initialized according to the server configuration, which defaults to "off" for PostgreSQL < 9, and "on" for PostgreSQL >= 9. You may need to adjust any string literals in your SQL queries, or set the variable yourself.
-
Exported (:.) from Database.PostgreSQL.Simple
-
Added some preliminary documentation for the Ok, Notification, and LargeObjects modules
-
Implemented the
fail
method for the monad instance forOk
. -
Fixed a bug relating to handling the transaction level
-
Renamed several modules, typeclasses, and functions:
QueryParams (renderParams) -> ToRow (toRow) QueryResults (convertResults) -> FromRow (fromRow) Param (render) -> ToField (toField) Result (convert) -> FromField (fromField)
-
Added the
Database.PostgreSQL.Simple.Ok
module, a variation ofEither SomeException
that has an instance forAlternative
and also uses a list of exceptions to track the ways it has failed. -
Changed the return type of
fromField
andfromRow
fromEither SomeException
toOk
. -
Thanks to suggestions from Ozgun Ataman, the
FromRow
typeclass has been massively improved. The result is simpler definitions and better compositionality. Also, user-defined instances need not be to be concerned about forcing the converted results to WHNF. Here is an example comparing the old to the new:instance (Result a, Result b) => QueryResults (a,b) where convertResults [fa,fb] [va,vb] = do !a <- convert fa va !b <- convert fb vb return (a,b) convertResults fs vs = convertError fs vs 2 instance (FromField a, FromField b) => FromRow (a,b) where fromRow = (,) <$> field <*> field
-
Added
(:.)
, a pair that allows one to composeFromRow
instances:instance (FromRow a, FromRow b) => FromRow (a :. b) where fromRow = (:.) <$> fromRow <*> fromRow
-
Moved the contents
Field
module into theFromField
module. -
Removed the
RawResult
type. -
Added
DefaultIsolationLevel
as a distinctIsolationLevel
option andDefaultReadWriteMode
as a distinctReadWriteMode
.