Skip to content

fix(postgres): install pgvector extension into default schema#1979

Merged
georgeh0 merged 1 commit into
mainfrom
g/fix-pgvector-extension-schema
May 15, 2026
Merged

fix(postgres): install pgvector extension into default schema#1979
georgeh0 merged 1 commit into
mainfrom
g/fix-pgvector-extension-schema

Conversation

@georgeh0

Copy link
Copy Markdown
Member

Summary

  • CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA "<pg_schema_name>" placed the vector type inside the per-app schema, so the subsequent unqualified vector(N) references in CREATE TABLE / ALTER TABLE failed with UndefinedObjectError: type "vector" does not exist (only the example's table schema, not public, was on search_path).
  • Drop the WITH SCHEMA clause and install pgvector into its default schema (typically public, already on search_path). Extensions are a database-wide resource, so coupling their location to a per-app schema was the wrong model and also blocked having two apps with different pg_schema_name in the same database.

Test plan

  • CI (existing test_postgres_target.py vector-index tests cover the path locally and passed).

The connector previously installed pgvector via
`CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA "<pg_schema_name>"`,
which placed the `vector` type inside the table's schema. The subsequent
`CREATE TABLE` / `ALTER TABLE` then referenced the unqualified `vector(N)`
type and failed with `type "vector" does not exist` because the table's
schema is not on the default `search_path`.

Extensions are a database-wide resource, so the right model is to install
into the extension's default schema (typically `public`, already on
`search_path`) regardless of where the target table lives.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@georgeh0 georgeh0 merged commit c74f4f1 into main May 15, 2026
18 checks passed
@georgeh0 georgeh0 deleted the g/fix-pgvector-extension-schema branch May 15, 2026 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant