Skip to content

Commit 60df808

Browse files
week_3: address review — warn loudly when pgvector backend runs on non-Postgres
Maintainer nit on OWASP#937: CRE_LIBRARIAN_RETRIEVER_BACKEND=pgvector is selectable via env, but the embedding_vec column doesn't land until W8. Emit a loud startup warning at pipeline-switch time when the backend is pgvector on a non-Postgres (e.g. SQLite) database, since retrieve() would otherwise fail with an opaque SQL error.
1 parent 695a016 commit 60df808

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

application/cmd/cre_main.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1067,6 +1067,16 @@ def run_librarian(
10671067
ph = prompt_client.PromptHandler(database=database)
10681068

10691069
backend = RetrieverBackend(cfg.retriever_backend)
1070+
if backend is RetrieverBackend.pgvector:
1071+
dialect = database.session.connection().dialect.name
1072+
if dialect != "postgresql":
1073+
logger.warning(
1074+
"CRE_LIBRARIAN_RETRIEVER_BACKEND=pgvector selected on a %r "
1075+
"database, but the pgvector backend needs Postgres with the "
1076+
"embedding_vec column (lands W8) and will fail at retrieve() "
1077+
"time here. Set the backend to in_memory until then.",
1078+
dialect,
1079+
)
10701080
# The CRE ids present in the hub are exactly the known ids the explicit
10711081
# resolver may auto-link to (W2 seeded this from the golden set; here it is
10721082
# the real DB-backed registry).

0 commit comments

Comments
 (0)