Setting the PostgreSQL version
By default, pg-embedded uses a PostgreSQL 13 database. This version can be changed in multiple ways:
- call
Builder.setServerVersion()on the EmbeddedPostgres.Builder - call
Builder.withInstancePreparer(b -> b.setServerVersion(...))on the DatabaseManagerBuilder - set the
pg-embedded.postgres-versionsystem property
Setting the system property overrides all other settings.
pg-embedded downloads repackaged EnterpriseDB PostgreSQL releases from the Maven repository system using the io.zonky.test.postgres groupId. Any artifact available here can be used with pg-embedded as long as the version and binary architecture is supported.
- More information about Zonky.IO PostgreSQL binaries.
- List of all available PostgreSQL versions. Only 9.6 and later versions are supported by
pg-embedded, older versions might still work but are unsupported (please do not file bug reports about older versions).
The FlywayPreparer only supports PostgreSQL 10+.
Tested
| OS | Architecture | Variant | Remarks |
|---|---|---|---|
| Linux | x86_64 | RHEL / CentOS | |
| Linux | x86_64 | Debian 11 (bullseye) | Needs locales-all installed for database locales to work |
| Linux | x86_64 | Alpine Linux | |
| Linux | x86_64 | Amazon Linux 2 | |
| Linux | aarch64 | Amazon Linux 2 | tested on AWS Graviton CPU |
| Linux | aarch64 | RockyLinux 8 | tested on Raspberry Pi 4 |
| Linux | aarch32 | CentOS 7 | tested on Raspberry Pi 3B+ |
| MacOS | x86_64 | MacOS 11.6+ | |
| MacOS | aarch64 | MacOS 12.5.1 with Rosetta 2 installed | All x86_64 binaries work as well, PostgreSQL 14 binaries contain both x86_64 and aarch64 variants. |
| MacOS | aarch64 | MacOS 12.5.1 without Rosetta 2 | Requires “fat” binaries that contain aarch64 variants. Otherwise, set the pg-embedded.prefer-native system property to true to force the use of aarch64 artifacts. Currently, only the PostgreSQL 14 supports this. |
Untested
| OS | Architecture | Variant | Remarks |
|---|---|---|---|
| Windows | x86_64 | - | untested, patches welcome |
| - | i386 | - | untested |
