From b29f32b51318c183c8e58830552808ad3135c59e Mon Sep 17 00:00:00 2001 From: BukeLy Date: Thu, 20 Nov 2025 03:12:18 +0800 Subject: [PATCH] fix: correct PostgreSQL migration parameter passing Why this change is needed: PostgreSQLDB.execute() expects data as a dictionary, not multiple positional arguments. The migration code was incorrectly unpacking a list with *values, causing TypeError. How it solves it: - Changed values from list to dict: {col: row_dict[col] for col in columns} - Pass values dict directly to execute() without unpacking - Matches execute() signature which expects dict[str, Any] | None Impact: - Fixes PostgreSQL E2E test failures - Enables successful legacy data migration for PostgreSQL Testing: - Will be verified by PostgreSQL E2E tests in CI --- lightrag/kg/postgres_impl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lightrag/kg/postgres_impl.py b/lightrag/kg/postgres_impl.py index 6144e835..1642c04b 100644 --- a/lightrag/kg/postgres_impl.py +++ b/lightrag/kg/postgres_impl.py @@ -2350,9 +2350,9 @@ class PGVectorStorage(BaseVectorStorage): ON CONFLICT DO NOTHING """ - # AsyncPG requires positional parameters as a list in order - values = [row_dict[col] for col in columns] - await db.execute(insert_query, *values) + # Construct dict for execute() method + values = {col: row_dict[col] for col in columns} + await db.execute(insert_query, values) migrated_count += len(rows) logger.info(