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 | Base | AI |
|---|---|---|---|---|
| 18.0 | Linux | x86_64 | Download | Download |
| 17.6 | Linux | x86_64 | Download | Download |
| 17.5 | Linux | x86_64 | Download | Download |
| 17.4 | Linux | x86_64 | Download | Download |
| 17.3 | Linux | x86_64 | Download | Download |
| 17.2 | Linux | x86_64 | Download | Download |
| 17.1 | Linux | x86_64 | Download | Download |
| 17.0 | Linux | x86_64 | Download | Download |
| 16.10 | Linux | x86_64 | Download | Download |
| 16.9 | Linux | x86_64 | Download | Download |
| 16.8 | Linux | x86_64 | Download | Download |
| 16.7 | Linux | x86_64 | Download | Download |
| 16.6 | Linux | x86_64 | Download | Download |
| 16.5 | Linux | x86_64 | Download | Download |
| 16.4 | Linux | x86_64 | Download | Download |
| 16.3 | Linux | x86_64 | Download | Download |
| 16.2 | Linux | x86_64 | Download | Download |
| 16.1 | Linux | x86_64 | Download | Download |
| 16.0 | Linux | x86_64 | Download | Download |
| 15.14 | Linux | x86_64 | Download | Download |
| 14.19 | Linux | x86_64 | Download | Download |
| 13.22 | Linux | x86_64 | Download | Download |
The AI variants (psql-ai-*) include everything in the base binary plus the following extensions, compiled from source and ready to use with CREATE EXTENSION:
| Extension | Description | Version |
|---|---|---|
| pgvector | Vector similarity search for embeddings (L2, inner product, cosine distance) | 0.8.0 (0.8.2 for PG18) |
| Apache AGE | Graph database extension — openCypher queries on top of PostgreSQL | 1.5.0–1.7.0 (varies by PG major) |
All PostgreSQL contrib modules (hstore, pg_trgm, uuid-ossp, etc.) are also included in both base and AI binaries.
CREATE EXTENSION vector; -- pgvector
CREATE EXTENSION age; -- Apache AGE
LOAD 'age'; -- AGE also requires LOAD
SET search_path = ag_catalog, "$user", public;-
Add the plugin to your project
In
plugins/BUILD:plugin_repo( name = "postgres", owner = "becomeliminal", revision = "v0.0.5", )
-
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.
-
Build with AI extensions (pgvector + Apache AGE)
postgres_ai( name = "psql_ai", version = "17.6", visibility = ["PUBLIC"], )
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.
For the AI variant with pgvector and Apache AGE:
subinclude("///postgres//build_defs:postgres")
postgres_ai_binary(
name = "postgres_ai",
version = "17.6",
visibility = ["PUBLIC"],
)Alternatively, you can directly download pre-built binaries from the GitHub release assets:
remote_file(
name = "psql",
url = "https://github.com/becomeliminal/postgres/releases/download/v0.0.5/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!