Why this change is needed: PostgreSQL requires an explicit conflict target specification when using ON CONFLICT with tables that have composite primary keys. Without it, PostgreSQL throws: "ON CONFLICT DO NOTHING requires inference specification or constraint name". This syntax error occurs during data migration from legacy tables when users upgrade from older LightRAG versions. How it solves it: Changed line 2378 from "ON CONFLICT DO NOTHING" to "ON CONFLICT (workspace, id) DO NOTHING" to match the table's PRIMARY KEY (workspace, id) constraint. This aligns with the correct syntax used in all other 12 ON CONFLICT clauses throughout the codebase (e.g., line 684, 5229, 5236, etc.). Impact: - Fixes migration failure in PGVectorStorage.setup_table() - Prevents syntax errors when migrating data from legacy tables - Maintains consistency with all other ON CONFLICT usages in postgres_impl.py - Affects users upgrading from pre-model-suffix table structure Testing: Verified by examining: - All 12 existing ON CONFLICT usages specify (workspace, id) - All PostgreSQL tables use PRIMARY KEY (workspace, id) - Migration code at line 684 uses identical correct syntax |
||
|---|---|---|
| .. | ||
| api | ||
| evaluation | ||
| kg | ||
| llm | ||
| tools | ||
| __init__.py | ||
| base.py | ||
| constants.py | ||
| exceptions.py | ||
| lightrag.py | ||
| namespace.py | ||
| operate.py | ||
| prompt.py | ||
| rerank.py | ||
| types.py | ||
| utils.py | ||
| utils_graph.py | ||