This repo provides build rules to compile PostgreSQL binaries from source for the Please build system.
Additionally, pre-built PostgreSQL Binary artifacts are available for download from the GitHub release assets.
| PostgreSQL Version | Supported OS | Supported Architecture | Download Link |
|---|---|---|---|
| 18.0 | Linux | x86_64 | Download |
| 17.6 | Linux | x86_64 | Download |
| 17.5 | Linux | x86_64 | Download |
| 17.4 | Linux | x86_64 | Download |
| 17.3 | Linux | x86_64 | Download |
| 17.2 | Linux | x86_64 | Download |
| 17.1 | Linux | x86_64 | Download |
| 17.0 | Linux | x86_64 | Download |
| 16.10 | Linux | x86_64 | Download |
| 16.9 | Linux | x86_64 | Download |
| 16.8 | Linux | x86_64 | Download |
| 16.7 | Linux | x86_64 | Download |
| 16.6 | Linux | x86_64 | Download |
| 16.5 | Linux | x86_64 | Download |
| 16.4 | Linux | x86_64 | Download |
| 16.3 | Linux | x86_64 | Download |
| 16.2 | Linux | x86_64 | Download |
| 16.1 | Linux | x86_64 | Download |
| 16.0 | Linux | x86_64 | Download |
| 15.14 | Linux | x86_64 | Download |
| 14.19 | Linux | x86_64 | Download |
| 13.22 | Linux | x86_64 | Download |
-
Add the plugin to your project
In
plugins/BUILD:plugin_repo( name = "postgres", owner = "jackmarsh", revision = "v0.0.3", )
-
Update your
.plzconfigAdd the following section:
[Plugin "postgres"] Target = //plugins:postgres
-
Use the PostgreSQL build rules in your project
After setting up the plugin, you can use the
postgresbuild rule to include PostgreSQL binaries in your project. Example:subinclude("///postgres//build_defs:postgres") postgres( name = "psql", version = "18.0", visibility = ["PUBLIC"], )
This will build the specified version of PostgreSQL binaries from source.
The postgres build definition allows you to customize the build process by passing flags to the configure script. This is useful if you need to enable or disable specific PostgreSQL features or specify custom installation paths.
You can pass configure_flags to the build rule like this:
postgres(
name = "psql",
version = "18.0",
configure_flags = ["--enable-debug", "--with-openssl"],
visibility = ["PUBLIC"],
)Make sure to pass the flags as a list in the format: ["--key", "value", "--key", "value"].
For a detailed explanation of the available configuration options, see the PostgreSQL Documentation on Configure Options.
Building PostgreSQL from source requires the following tools and libraries to be installed on your system:
Required Tools:
gccmakeautomakeautoconfflexbisonperlpkg-config
Required Libraries:
libicu-devlibreadline-dev
You can use the provided setup target to install the required tools and libraries into your environment:
plz run ///postgres//:setupThis will ensure all dependencies are available in the path, allowing the postgres binary to compile from source successfully.
If you prefer not to build PostgreSQL from source, use the postgres_binary rule to download pre-built binaries. This is much faster, especially for Remote Build Execution (RBE) where workers just download ~10MB instead of compiling for 5-10 minutes.
subinclude("///postgres//build_defs:postgres")
postgres_binary(
name = "postgres",
version = "17.2",
visibility = ["PUBLIC"],
)The postgres_binary rule provides the same output structure as postgres (bin, lib, include, share), so it's a drop-in replacement.
Alternatively, you can directly download pre-built binaries from the GitHub release assets:
remote_file(
name = "psql",
url = "https://github.com/jackmarsh/postgres/releases/download/v0.0.3/psql-18.0-linux_x86_64.tar.gz",
hashes = ["<hash of the file>"], # Optional
)You can find pre-built binaries for supported OS and architecture combinations in the release page.
You may need to pass the -L /path/to/psql/share flag to initdb.
You can find all available versions and corresponding binaries on the releases page.
If you need a pre-built binary for a specific PostgreSQL version, operating system, or architecture that is not currently included in the release assets, feel free to reach out or open an issue.
We're happy to consider adding additional prebuilt binaries to future releases!