From 347c8aa23f96d92cb02e9b35bd8488f486b35fe0 Mon Sep 17 00:00:00 2001 From: Tobias Florek Date: Wed, 8 Apr 2026 09:41:41 +0200 Subject: [PATCH] add pg-uuidv7 Signed-off-by: Tobias Florek --- .github/workflows/bake.yml | 4 +++ pg-uuidv7/Dockerfile | 25 +++++++++++++++ pg-uuidv7/README.md | 65 ++++++++++++++++++++++++++++++++++++++ pg-uuidv7/metadata.hcl | 35 ++++++++++++++++++++ 4 files changed, 129 insertions(+) create mode 100644 pg-uuidv7/Dockerfile create mode 100644 pg-uuidv7/README.md create mode 100644 pg-uuidv7/metadata.hcl diff --git a/.github/workflows/bake.yml b/.github/workflows/bake.yml index efbbfb0..4518d00 100644 --- a/.github/workflows/bake.yml +++ b/.github/workflows/bake.yml @@ -13,6 +13,7 @@ on: - postgis - pgaudit - pg-crash + - pg-uuidv7 defaults: run: @@ -55,6 +56,9 @@ jobs: pg-crash: - 'pg-crash/**' - *shared + pg-uuidv7: + - 'pg-uuidv7/**' + - *shared # Compute a matrix containing the list of all extensions that have been modified - name: Compute matrix diff --git a/pg-uuidv7/Dockerfile b/pg-uuidv7/Dockerfile new file mode 100644 index 0000000..e02e518 --- /dev/null +++ b/pg-uuidv7/Dockerfile @@ -0,0 +1,25 @@ +ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie +FROM $BASE AS builder + +ARG PG_MAJOR +ARG EXT_VERSION + +USER 0 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends "postgresql-${PG_MAJOR}-pg-uuidv7=${EXT_VERSION}" + +FROM scratch +ARG PG_MAJOR + +# Licenses +COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-pg-uuidv7/copyright /licenses/postgresql-${PG_MAJOR}-pg-uuidv7/ + +# Libraries +COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/pg_uuidv7* /lib/ +COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/bitcode/ /lib/bitcode/ + +# Share +COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/extension/pg_uuidv7* /share/extension/ + +USER 65532:65532 diff --git a/pg-uuidv7/README.md b/pg-uuidv7/README.md new file mode 100644 index 0000000..4c87b3d --- /dev/null +++ b/pg-uuidv7/README.md @@ -0,0 +1,65 @@ +# PG-UUIDv7 + +[PG-UUIDv7](https://github.com/pg-uuidv7/pg-uuidv7) is a tiny Postgres extension +to create valid version 7 UUIDs in PostgresQL. + +This image provides a convenient way to deploy and manage `pg-uuidv7` with +[CloudNativePG](https://cloudnative-pg.io/). + +## Usage + +### 1. Add the pg-uuidv7 extension image to your Cluster + +Define the `pg-uuidv7` extension under the `postgresql.extensions` section of +your `Cluster` resource. For example: + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Cluster +metadata: + name: cluster-pg-uuidv7 +spec: + imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie + instances: 1 + + storage: + size: 1Gi + + postgresql: + extensions: + - name: pg-uuidv7 + image: + # renovate: suite=trixie-pgdg depName=postgresql-18-pg-uuidv7 + reference: ghcr.io/cloudnative-pg/pg-uuidv7:0.8.2-18-trixie +``` + +### 2. Enable the extension in a database + +You can install `pg-uuidv7` in a specific database by creating or updating a +`Database` resource. For example, to enable it in the `app` database: + +```yaml +apiVersion: postgresql.cnpg.io/v1 +kind: Database +metadata: + name: cluster-pg-uuidv7-app +spec: + name: app + owner: app + cluster: + name: cluster-pg-uuidv7 + extensions: + - name: pg_uuidv7 + # renovate: suite=trixie-pgdg depName=postgresql-18-pg-uuidv7 extractVersion=^(?\d+\.\d+\.\d+) + version: '0.8.2' +``` + +### 3. Verify installation + +Once the database is ready, connect to it with `psql` and run: + +```sql +\dx +``` + +You should see `pg_uuidv7` listed among the installed extensions. diff --git a/pg-uuidv7/metadata.hcl b/pg-uuidv7/metadata.hcl new file mode 100644 index 0000000..2734f82 --- /dev/null +++ b/pg-uuidv7/metadata.hcl @@ -0,0 +1,35 @@ +metadata = { + name = "pg-uuidv7" + sql_name = "pg_uuidv7" + image_name = "pg-uuidv7" + licenses = ["PostgreSQL"] + shared_preload_libraries = [] + postgresql_parameters = {} + extension_control_path = [] + dynamic_library_path = [] + ld_library_path = [] + bin_path = [] + env = {} + auto_update_os_libs = false + required_extensions = [] + create_extension = true + + versions = { + bookworm = { + "18" = { + // renovate: suite=bookworm-pgdg depName=postgresql-18-pg-uuidv7 + package = "1.7.0-1.pgdg12+1" + // renovate: suite=bookworm-pgdg depName=postgresql-18-pg-uuidv7 extractVersion=^(?\d+\.\d+) + sql = "1.7" + } + } + trixie = { + "18" = { + // renovate: suite=trixie-pgdg depName=postgresql-18-pg-uuidv7 + package = "1.7.0-1.pgdg13+1" + // renovate: suite=trixie-pgdg depName=postgresql-18-pg-uuidv7 extractVersion=^(?\d+\.\d+) + sql = "1.7" + } + } + } +}