Backend for the persistent library using postgresql.

Version on this page:
LTS Haskell 21.24:
Stackage Nightly 2023-12-11:
Latest on Hackage:

See all snapshots persistent-postgresql appears in

MIT licensed by Felipe Lessa, Michael Snoyman
Maintained by Michael Snoyman
This version can be pinned in stack with:persistent-postgresql-,1594

Module documentation for

Based on the postgresql-simple package


  • Allow postgresql-simple 0.5

Query pg_catalog instead of information_schema for metadata. This helps with permission issues as reported in issue #501


  • Fix treatment of NULLs inside arrays. For example, now you can use array_agg on a nullable column.

  • New derived instances for PostgresConf: Read, Data and Typeable.

  • New mockMigration function. Works like printMigration but doesn’t need a database connection.

  • Fix typo on error message of the FromJSON instance of PostgresConf.


  • Optimize the insertMany function to insert all rows and retrieve their keys in one SQL query. #407


  • Postgresql exceptions #353

Migrations for custom primary keys

Support foreign key references to composite primary keys #389


  • Allow timestamp value in database to be serialized (presumes UTC timezone) Yesod #391


  • Treat unknown extension types as PersistDbSpecific values #385


Documentation typo fix


Added FromJSON instance for PostgresConf.