Skip to content

Remove inline ALTER TABLE from postgres_search_repository #727

@phernandez

Description

@phernandez

Problem

PR #723 added inline ALTER TABLE statements in postgres_search_repository.py (lines ~324-360) that run at runtime during every vector sync initialization. These add entity_fingerprint and embedding_model columns to search_vector_chunks.

This causes deadlocks when two concurrent index jobs hit the same database — both try to ALTER TABLE simultaneously and Postgres detects the deadlock.

The alembic migration for these columns already exists: m6h7i8j9k0l1_add_vector_sync_fingerprints.py

Fix

Delete the inline DDL from postgres_search_repository.py. The alembic migration handles schema changes. Runtime code should never run ALTER TABLE.

File

src/basic_memory/repository/postgres_search_repository.py — remove the ALTER TABLE / ADD COLUMN IF NOT EXISTS block

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions