Skip to content

becomeliminal/postgres

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PostgreSQL Binaries

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.

Pre-Built Binaries: Supported Versions

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

AI Binaries

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.

Enabling extensions

CREATE EXTENSION vector;         -- pgvector
CREATE EXTENSION age;            -- Apache AGE
LOAD 'age';                      -- AGE also requires LOAD
SET search_path = ag_catalog, "$user", public;

Basic Usage

Option 1: Use as a Please Plugin

  1. Add the plugin to your project

    In plugins/BUILD:

    plugin_repo(
        name = "postgres",
        owner = "becomeliminal",
        revision = "v0.0.5",
    )
  2. Update your .plzconfig

    Add the following section:

    [Plugin "postgres"]
    Target = //plugins:postgres
  3. Use the PostgreSQL build rules in your project

    After setting up the plugin, you can use the postgres build 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.

  4. Build with AI extensions (pgvector + Apache AGE)

    postgres_ai(
        name = "psql_ai",
        version = "17.6",
        visibility = ["PUBLIC"],
    )

Configuring Custom Build Flags

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.

Example

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.


Required Tools and Libraries

Building PostgreSQL from source requires the following tools and libraries to be installed on your system:

Required Tools:

  • gcc
  • make
  • automake
  • autoconf
  • flex
  • bison
  • perl
  • pkg-config

Required Libraries:

  • libicu-dev
  • libreadline-dev

Installing Dependencies with Please

You can use the provided setup target to install the required tools and libraries into your environment:

plz run ///postgres//:setup

This will ensure all dependencies are available in the path, allowing the postgres binary to compile from source successfully.


Option 2: Use Pre-built Binaries (Recommended for RBE)

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"],
)

Manual Download

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.


Notes

You may need to pass the -L /path/to/psql/share flag to initdb.


Releases

You can find all available versions and corresponding binaries on the releases page.


Need Additional Pre-Built Binaries?

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!

About

Tool for building PostgreSQL binaries from source via Please

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors