Skip to content

Commit 8e49a36

Browse files
committed
add pg-uuidv7
Signed-off-by: Tobias Florek <me@ibotty.net>
1 parent fd09e3f commit 8e49a36

4 files changed

Lines changed: 126 additions & 0 deletions

File tree

.github/workflows/bake.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ on:
1313
- postgis
1414
- pgaudit
1515
- pg-crash
16+
- pg-uuidv7
1617

1718
defaults:
1819
run:

pg-uuidv7/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
ARG BASE=ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
2+
FROM $BASE AS builder
3+
4+
ARG PG_MAJOR
5+
ARG EXT_VERSION
6+
7+
USER 0
8+
9+
RUN apt-get update && \
10+
apt-get install -y --no-install-recommends "postgresql-${PG_MAJOR}-pg-uuidv7=${EXT_VERSION}"
11+
12+
FROM scratch
13+
ARG PG_MAJOR
14+
15+
# Licenses
16+
COPY --from=builder /usr/share/doc/postgresql-${PG_MAJOR}-pg-uuidv7/copyright /licenses/postgresql-${PG_MAJOR}-pg-uuidv7/
17+
18+
# Libraries
19+
COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/pg_uuidv7* /lib/
20+
COPY --from=builder /usr/lib/postgresql/${PG_MAJOR}/lib/bitcode/ /lib/bitcode/
21+
22+
# Share
23+
COPY --from=builder /usr/share/postgresql/${PG_MAJOR}/extension/pg_uuidv7* /share/extension/
24+
25+
USER 65532:65532

pg-uuidv7/README.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# PG-UUIDv7
2+
3+
[PG-UUIDv7](https://github.com/pg-uuidv7/pg-uuidv7) is a tiny Postgres extension
4+
to create valid version 7 UUIDs in PostgresQL.
5+
6+
This image provides a convenient way to deploy and manage `pg-uuidv7` with
7+
[CloudNativePG](https://cloudnative-pg.io/).
8+
9+
## Usage
10+
11+
### 1. Add the pg-uuidv7 extension image to your Cluster
12+
13+
Define the `pg-uuidv7` extension under the `postgresql.extensions` section of
14+
your `Cluster` resource. For example:
15+
16+
```yaml
17+
apiVersion: postgresql.cnpg.io/v1
18+
kind: Cluster
19+
metadata:
20+
name: cluster-pg-uuidv7
21+
spec:
22+
imageName: ghcr.io/cloudnative-pg/postgresql:18-minimal-trixie
23+
instances: 1
24+
25+
storage:
26+
size: 1Gi
27+
28+
postgresql:
29+
extensions:
30+
- name: pg-uuidv7
31+
image:
32+
# renovate: suite=trixie-pgdg depName=postgresql-18-pg-uuidv7
33+
reference: ghcr.io/cloudnative-pg/pg-uuidv7:0.8.2-18-trixie
34+
```
35+
36+
### 2. Enable the extension in a database
37+
38+
You can install `pg-uuidv7` in a specific database by creating or updating a
39+
`Database` resource. For example, to enable it in the `app` database:
40+
41+
```yaml
42+
apiVersion: postgresql.cnpg.io/v1
43+
kind: Database
44+
metadata:
45+
name: cluster-pg-uuidv7-app
46+
spec:
47+
name: app
48+
owner: app
49+
cluster:
50+
name: cluster-pg-uuidv7
51+
extensions:
52+
- name: pg_uuidv7
53+
# renovate: suite=trixie-pgdg depName=postgresql-18-pg-uuidv7 extractVersion=^(?<version>\d+\.\d+\.\d+)
54+
version: '0.8.2'
55+
```
56+
57+
### 3. Verify installation
58+
59+
Once the database is ready, connect to it with `psql` and run:
60+
61+
```sql
62+
\dx
63+
```
64+
65+
You should see `pg_uuidv7` listed among the installed extensions.

pg-uuidv7/metadata.hcl

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
metadata = {
2+
name = "pg-uuidv7"
3+
sql_name = "pg_uuidv7"
4+
image_name = "pg-uuidv7"
5+
licenses = ["PostgreSQL"]
6+
shared_preload_libraries = []
7+
postgresql_parameters = {}
8+
extension_control_path = []
9+
dynamic_library_path = []
10+
ld_library_path = []
11+
bin_path = []
12+
env = {}
13+
auto_update_os_libs = false
14+
required_extensions = []
15+
create_extension = true
16+
17+
versions = {
18+
bookworm = {
19+
"18" = {
20+
// renovate: suite=bookworm-pgdg depName=postgresql-18-pg-uuidv7
21+
package = "1.7.0-1.pgdg12+1"
22+
// renovate: suite=bookworm-pgdg depName=postgresql-18-pg-uuidv7 extractVersion=^(?<version>\d+\.\d+)
23+
sql = "1.7"
24+
}
25+
}
26+
trixie = {
27+
"18" = {
28+
// renovate: suite=trixie-pgdg depName=postgresql-18-pg-uuidv7
29+
package = "1.7.0-1.pgdg13+1"
30+
// renovate: suite=trixie-pgdg depName=postgresql-18-pg-uuidv7 extractVersion=^(?<version>\d+\.\d+)
31+
sql = "1.7"
32+
}
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)