Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/bake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ on:
- postgis
- pgaudit
- pg-crash
- pg-uuidv7

defaults:
run:
Expand Down Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions pg-uuidv7/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
65 changes: 65 additions & 0 deletions pg-uuidv7/README.md
Original file line number Diff line number Diff line change
@@ -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=^(?<version>\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.
35 changes: 35 additions & 0 deletions pg-uuidv7/metadata.hcl
Original file line number Diff line number Diff line change
@@ -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=^(?<version>\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=^(?<version>\d+\.\d+)
sql = "1.7"
}
}
}
}