Compare commits

...

1 Commits

Author SHA1 Message Date
Zamil Majdy
dbb08c22b6 fix(backend): make default schema consistent in db.py
The search_path setup at module init defaulted to "platform" when no
schema was in DATABASE_URL, but get_database_schema() defaults to
"public". This caused a mismatch where search_path used platform
schema but raw SQL queries used public schema.

Changed search_path setup to also default to "public" for consistency.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-14 22:26:52 +00:00

View File

@@ -40,10 +40,10 @@ if POOL_TIMEOUT:
# Add public schema to search_path for pgvector type access
# The vector extension is in public schema, but search_path is determined by schema parameter
# Extract the schema from DATABASE_URL or default to 'platform'
# Extract the schema from DATABASE_URL or default to 'public' (matching get_database_schema())
parsed_url = urlparse(DATABASE_URL)
url_params = dict(parse_qsl(parsed_url.query))
db_schema = url_params.get("schema", "platform")
db_schema = url_params.get("schema", "public")
# Build search_path, avoiding duplicates if db_schema is already 'public'
search_path_schemas = list(
dict.fromkeys([db_schema, "public"])