persistent-postgresql
Backend for the persistent library using postgresql.
http://www.yesodweb.com/book/persistent
| LTS Haskell 24.17: | 2.13.7.0 | 
| Stackage Nightly 2025-10-31: | 2.14.0.0 | 
| Latest on Hackage: | 2.14.0.0 | 
persistent-postgresql-2.14.0.0@sha256:4e24fb462c00e69a055441f7b15a36f33f65e8e97d4396c633231c86c2c91871,2930Module documentation for 2.14.0.0
- Database
Based on the postgresql-simple package
Changes
Changelog for persistent-postgresql
2.14.0.0
- #1604
- Changed the representation of intervals to use the Intervaltype from thepostgresql-simple-intervalpackage. This changes the behavior ofPgIntervalfor very small and very large values.
- Previously PgInterval 0.000_000_9would be rounded to0.000_001seconds, but now it is truncated to 0 seconds.
- Previously PgInterval 9_223_372_036_854.775_808would overflow and throw a SQL error, but now it saturates to9_223_372_036_854.775_807seconds.
- The SQL representation of PgIntervalnow always includes theintervalprefix, likeinterval '1 second'.
 
- Changed the representation of intervals to use the 
2.13.7.0
- #1600
- Add migrateStructuredtoDatabase.Persist.Postgresql.Internal. This allows you to access a structured representation of the proposed migrations for use in your application.
 
- Add 
- #1547
- Bump libpqbounds
 
- Bump 
2.13.6.2
- #1536
- Build with GHC 9.10
 
2.13.6.1
- #1518
- Normalize postgres type aliases to prevent noop migrations
 
2.13.6
- #1511
- Add the createPostgresqlPoolTailoredfunction to support creating connection pools with a custom connection creation function.
- Expose getServerVersionandcreateBackendfor user’s convenience.
 
- Add the 
- #1516
- Support postgresql-simple 0.7 and postgresql-libpq 0.10
 
2.13.5.2
- #1471
- Explicitly import Control.Monad.Trans.liftto support mtl-2.3.
 
- Explicitly import 
2.13.5.1
- #1459
- Make use of CautiousMigrationtype alias for clarity.
 
- Make use of 
2.13.5.0
- #1362
- Define withPostgresqlPoolModifiedWithVersion
 
- Define 
2.13.4.1
2.13.4.0
- #1341
- Add SqlBackendHooksto allow for instrumentation of queries.
 
- Add 
- #1327
- Update backend to support new StatementCacheinterface
 
- Update backend to support new 
2.13.3.0
- #1349
- Add BackendCompatible (RawPostgresql b) (RawPostgresql b)instance.
 
- Add 
2.13.2.2
- #1351
- Support aeson-2.0in test suite.
 
- Support 
2.13.2.1
- #1331
- Fixes a bug where upsertWherewould fail on a database table withMigrationOnlyfields.
 
- Fixes a bug where 
2.13.2.0
- #1316
- Expose some internals in the new Database.Persist.Postgresql.Internalmodule. This gives access to thePnewtype, which is used for de-serializingPersistValues frompostgresql-simplecode.
 
- Expose some internals in the new 
2.13.1.0
- #1305
- Add RawPostgresqlwrapper, which exposes the underlying Postgres connection used to construct aSqlBackend.
 
- Add 
2.13.0.3
- #1290
- Fix the code path for adding references to previously defined columns.
 
2.13.0.2
- Actually release the SafeTORemove fix
2.13.0.1
- #1275
- Fix SafeToRemove
 
- Fix 
2.13.0.0
- #1225
- Support persistent-2.13.0.0making SQlBackend internal
 
- Support 
2.12.1.1
- #1235
- upsertWhereand- upsertManyWhereonly worked in cases where a- Primarykey was defined on a record, and no other uniqueness constraints. They have been fixed to only work with records that have a single Uniqueness constraint defined.
 
2.12.1.0
- Added upsertWhereandupsertManyWheretopersistent-postgresql. #1222.
2.12.0.0
- Decomposed HaskellNameintoConstraintNameHS,EntityNameHS,FieldNameHS. DecomposedDBNameintoConstraintNameDB,EntityNameDB,FieldNameDBrespectively. #1174
- Fix XML conversion #1192
2.11.0.1
- Fix foreign key migrations [#1167] https://github.com/yesodweb/persistent/pull/1167
- Fix a bug where a foreign key of a field to its table was ignored.
- Fix a bug where a altering details of a foreign key didn’t trigger a migration
 
2.11.0.0
- Foreign Key improvements [#1121] https://github.com/yesodweb/persistent/pull/1121
- It is now supported to refer to a table with an auto generated Primary Kay
- It is now supported to refer to non-primary fields, using the keyword References
 
- Implement interval support. #1053
- #1060
- The QuasiQuoter now supports OnDeleteandOnUpdatecascade options.
 
- The QuasiQuoter now supports 
- Handle foreign key constraint names over 63 characters. See #996 for details.
- Fix a bug in upsertSqlquery which had not been discovered previously because the query wasn’t actually used. #856
- #1072 Refactored test/JSONTest.hsto usehspec- added runConn_to run a db connection and return result
- Renamed dbtorunConnAssertintest/PgInit.hsfor clarity
- Ran test/ArrayAggTest.hs(which was previously written but not being run)
 
- added 
- Remove unnecessary deriving of Typeable #1114
- Add support for configuring the number of stripes and idle timeout for connection pools #1098
- PostgresConfhas two new fields to configure these values.- Its FromJSONinstance will default stripes to 1 and idle timeout to 600 seconds
- If you’re constructing a PostgresConfmanually, this is a breaking change
 
- Its 
- Add createPostgresqlPoolWithConfandwithPostgresqlPoolWithConf, which take aPostgresConffor the new configuration.
 
2.10.1.2
- Fix issue with multiple foreign keys on single column. #1010
2.10.1.1
- Compatibility with latest persistent-template for test suite #1002
2.10.1
- Added support for the constraint=attribute to the Postgresql backend. #979
2.10.0
- Added question mark operators ((?.), (?|.), (?&.)) toDatabase.Persist.Postgresql.JSON#863
- Changes to certain types:
- PersistValue: added- PersistArraydata constructor
- Filter: Changed the- filterValue :: Either a [a]to- filterValue :: FilterValue
 
2.9.1
- Add openSimpleConnWithVersionfunction. #883
2.9.0
- Added support for SQL isolation levels to via SqlBackend. [#812]
- Fix 832: repsertManynow matchesmapM_ (uncurry repsert)and is atomic.
2.8.2
Added module Database.Persist.Postgresql.JSON #793
- PersistFieldand- PersistFieldSqlinstances for- Data.Aeson.Value
- Filter operators (@>.)and(<@.)to filter on JSON values
2.8.1.1
- Added a more detailed error message when a numericcolumn’s scale and precision can’t be parsed. #781
2.8.1
- Implemented connPutManySqlto utilize batchedputMany. #770
2.8.0
- Switch from MonadBaseControltoMonadUnliftIO
2.6.3
- Added new function migrateEnableExtension, to enable Postgres extensions in migrations.
2.6.2.2
- Because textandvarcharare synonyms in Postgresql, don’t attempt to migrate between them. #762
2.6.2.1
- Fix bug where, if a custom column width was set, the field would be migrated every time #742
2.6.2
- Expose new functions: withPostgresqlPoolWithVersion,withPostgresqlConnWithVersionandcreatePostgresqlPoolModifiedWithVersion.
2.6.1
- Match changes in persistent
- Clean up warnings
2.6
- Atomic upsert support for postgreSQL backend
2.5
- changes for read/write typeclass split
2.2.2
- Postgresql primary key is Int4, not Int8 #519
2.2.1.2
- Allow postgresql-simple 0.5
2.2.1.1
Query pg_catalog instead of information_schema for metadata. This helps with permission issues as reported in issue #501
2.2.1
- 
Fix treatment of NULLs inside arrays. For example, now you can usearray_aggon a nullable column.
- 
New derived instances for PostgresConf:Read,DataandTypeable.
- 
New mockMigrationfunction. Works likeprintMigrationbut doesn’t need a database connection.
- 
Fix typo on error message of the FromJSONinstance ofPostgresConf.
2.2
- Optimize the insertManyfunction to insert all rows and retrieve their keys in one SQL query. #407
2.1.6
- Postgresql exceptions #353
2.1.5.3
Migrations for custom primary keys
2.1.5.2
Support foreign key references to composite primary keys #389
2.1.5
- Allow timestamp value in database to be serialized (presumes UTC timezone) Yesod #391
2.1.4
- Treat unknown extension types as PersistDbSpecific values #385
2.1.3
- Added a Showinstance forPostgresConf.
- createPostgresqlPoolModifiedadded, see relevant mailing list discussion
2.1.2.1
Documentation typo fix
2.1.1
Added FromJSON instance for PostgresConf.
