Skip to content

fix: temp table schema qualification in pgvector backend#36

Merged
nicoloesch merged 1 commit into
mainfrom
35-undefined-table
Jul 2, 2026
Merged

fix: temp table schema qualification in pgvector backend#36
nicoloesch merged 1 commit into
mainfrom
35-undefined-table

Conversation

@nicoloesch

Copy link
Copy Markdown
Collaborator

apply_concept_filter_where built IN-subqueries using SQLAlchemy Table objects with no explicit schema. Passing any schema_translate_map to the engine, these references become schema._knn_doms etc. before the query reached PostgreSQL. Temp tables live in pg_temp, so the lookup failed.

Fix: replace the three in_(select(KNN_*_CORE_TABLE.c.id)) calls with text() raw-SQL subqueries, which bypass schema_translate_map and let PostgreSQL resolve the names through the session's implicit pg_temp search-path prefix. The _TEMP_FILTER_METADATA and KNN_*_CORE_TABLE constants are removed as they are no longer used.

The KNN_*_TABLE string constants are kept so setup_concept_filter_temps (DDL) and apply_concept_filter_where (DML) stay in sync by name. SQLite is unaffected, as unqualified names in text() are resolved through SQLite's own temp schema.

@nicoloesch nicoloesch requested a review from gkennos July 1, 2026 04:18

@gkennos gkennos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as discussed - this is a pragmatic hot-fix until temp schema management can be thought through more fully - approving on the assumption that issues will be raise to track that larger concern

@nicoloesch nicoloesch merged commit ba5a055 into main Jul 2, 2026
3 checks passed
@nicoloesch nicoloesch deleted the 35-undefined-table branch July 2, 2026 02:22
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.

pgvector backend raises UndefinedTable for temp filter tables when schema_translate_map is active

2 participants