LightRAG/lightrag/kg
BukeLy 4c12301e81 fix: correct parameter passing in delete_entity_relation
Why this change is needed:
The previous fix in commit 7dc1f83e incorrectly "fixed" delete_entity_relation
by converting the parameter dict to a list. However, PostgreSQLDB.execute()
expects a dict[str, Any] parameter, not a list. The execute() method internally
converts dict values to tuple (line 1487: tuple(data.values())), so passing
a list bypasses the expected interface and causes parameter binding issues.

What was wrong:
```python
params = {"workspace": self.workspace, "entity_name": entity_name}
await self.db.execute(delete_sql, list(params.values()))  # WRONG
```

The correct approach (matching delete_entity method):
```python
await self.db.execute(
    delete_sql, {"workspace": self.workspace, "entity_name": entity_name}
)
```

How it solves it:
- Pass parameters as a dict directly to db.execute(), matching the method signature
- Maintain consistency with delete_entity() which correctly passes a dict
- Let db.execute() handle the dict-to-tuple conversion internally as designed

Impact:
- delete_entity_relation now correctly passes parameters to PostgreSQL
- Method interface consistency with other delete operations
- Proper parameter binding ensures reliable entity relation deletion

Testing:
- All 6 PostgreSQL migration tests pass
- Verified parameter passing matches delete_entity pattern
- Code review identified the issue before production use

Related:
- Fixes incorrect "fix" from commit 7dc1f83e
- Aligns with PostgreSQLDB.execute() interface (line 1477-1480)
2025-11-19 23:31:09 +08:00
..
deprecated Preserve ordering in get_by_ids methods across all storage implementations 2025-10-11 12:37:59 +08:00
__init__.py Improve storage config validation and add config.ini fallback support 2025-11-08 22:48:49 +08:00
faiss_impl.py Remove final_namespace attribute for in-memory storage and use namespace in clean_llm_query_cache.py 2025-11-17 12:54:33 +08:00
json_doc_status_impl.py Remove final_namespace attribute for in-memory storage and use namespace in clean_llm_query_cache.py 2025-11-17 12:54:33 +08:00
json_kv_impl.py Remove final_namespace attribute for in-memory storage and use namespace in clean_llm_query_cache.py 2025-11-17 12:54:33 +08:00
memgraph_impl.py Refactor workspace handling to use default workspace and namespace locks 2025-11-17 12:54:33 +08:00
milvus_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-11-17 12:54:33 +08:00
mongo_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-11-17 12:54:33 +08:00
nano_vector_db_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-11-17 12:54:33 +08:00
neo4j_impl.py Refactor workspace handling to use default workspace and namespace locks 2025-11-17 12:54:33 +08:00
networkx_impl.py Remove final_namespace attribute for in-memory storage and use namespace in clean_llm_query_cache.py 2025-11-17 12:54:33 +08:00
postgres_impl.py fix: correct parameter passing in delete_entity_relation 2025-11-19 23:31:09 +08:00
qdrant_impl.py feat: Qdrant model isolation and auto-migration 2025-11-19 18:47:38 +08:00
redis_impl.py Standardize empty workspace handling from "_" to "" across storage 2025-11-17 12:54:33 +08:00
shared_storage.py feat: Qdrant model isolation and auto-migration 2025-11-19 18:47:38 +08:00