fix(postgres): install pgvector extension into default schema#1979
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CREATE EXTENSION IF NOT EXISTS vector WITH SCHEMA "<pg_schema_name>"placed thevectortype inside the per-app schema, so the subsequent unqualifiedvector(N)references inCREATE TABLE/ALTER TABLEfailed withUndefinedObjectError: type "vector" does not exist(only the example's table schema, notpublic, was onsearch_path).WITH SCHEMAclause and install pgvector into its default schema (typicallypublic, already onsearch_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 differentpg_schema_namein the same database.Test plan
test_postgres_target.pyvector-index tests cover the path locally and passed).