From e0eb7c060792c72a6dc23181f78484ef2899fc65 Mon Sep 17 00:00:00 2001 From: xieydd Date: Sun, 7 Apr 2024 20:18:27 +0800 Subject: [PATCH] chore: Add document about enable pgvecto.rs extension when database initialization Signed-off-by: xieydd --- Dockerfile | 4 ---- README.md | 13 +++++++++++++ install-pgvectors.sql | 2 -- 3 files changed, 13 insertions(+), 6 deletions(-) delete mode 100644 install-pgvectors.sql diff --git a/Dockerfile b/Dockerfile index 1c2cfc2..be412e0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,7 +14,3 @@ RUN apt install ./pgvectors.deb USER postgres -# From https://stackoverflow.com/a/42508925 -# Note that this way of enabling the plugin only works on database init -# We should investigate alternative ways of enabling it that will always work -COPY install-pgvectors.sql /docker-entrypoint-initdb.d/ diff --git a/README.md b/README.md index 9c15ade..5cca143 100644 --- a/README.md +++ b/README.md @@ -14,3 +14,16 @@ Container images for [cloudnative-pg](https://cloudnative-pg.io/) with the [pgve > shared_preload_libraries: > - "vectors.so" > ``` + +> [!IMPORTANT] +> The `pgvecto.rs` extension is not enabled by default. You need to enable it and set the search path when database initialization. You can configure it in your Cluster spec: +> ```yaml +> apiVersion: postgresql.cnpg.io/v1 +> kind: Cluster +> spec: +> (...) +> bootstrap: +> initdb: +> postInitSQL: +> - ALTER SYSTEM SET search_path TO "$user", public, vectors; +> - CREATE EXTENSION IF NOT EXISTS "vectors"; \ No newline at end of file diff --git a/install-pgvectors.sql b/install-pgvectors.sql deleted file mode 100644 index f757434..0000000 --- a/install-pgvectors.sql +++ /dev/null @@ -1,2 +0,0 @@ -ALTER SYSTEM SET shared_preload_libraries = "vectors.so" -ALTER SYSTEM SET search_path = "$user", public, vectors