diff --git a/lightrag/kg/postgres_impl.py b/lightrag/kg/postgres_impl.py index 9cef3dde..c9ea40f7 100644 --- a/lightrag/kg/postgres_impl.py +++ b/lightrag/kg/postgres_impl.py @@ -2237,6 +2237,8 @@ async def _pg_migrate_workspace_data( VALUES ({placeholders}) ON CONFLICT (workspace, id) DO NOTHING """ + # Rebuild dict in columns order to ensure values() matches placeholders order + # Python 3.7+ dicts maintain insertion order, and execute() uses tuple(data.values()) values = {col: row_dict[col] for col in columns} await db.execute(insert_query, values) @@ -3058,11 +3060,8 @@ class PGDocStatusStorage(DocStatusStorage): # Use "default" for compatibility (lowest priority) self.workspace = "default" - # Create table if not exists - table_name = namespace_to_table_name(self.namespace) - table_exists = await _pg_table_exists(self.db, table_name) - if not table_exists: - await _pg_create_table(self.db, table_name, table_name) + # NOTE: Table creation is handled by PostgreSQLDB.initdb() during initialization + # No need to create table here as it's already created in the TABLES dict async def finalize(self): if self.db is not None: diff --git a/uv.lock b/uv.lock index 019f7539..97703af0 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 2 +revision = 3 requires-python = ">=3.10" resolution-markers = [ "python_full_version >= '3.14' and python_full_version < '4' and platform_machine == 'x86_64' and sys_platform == 'darwin'", @@ -2735,6 +2735,7 @@ requires-dist = [ { name = "json-repair", marker = "extra == 'api'" }, { name = "langfuse", marker = "extra == 'observability'", specifier = ">=3.8.1" }, { name = "lightrag-hku", extras = ["api", "offline-llm", "offline-storage"], marker = "extra == 'offline'" }, + { name = "lightrag-hku", extras = ["pytest"], marker = "extra == 'evaluation'" }, { name = "llama-index", marker = "extra == 'offline-llm'", specifier = ">=0.9.0,<1.0.0" }, { name = "nano-vectordb" }, { name = "nano-vectordb", marker = "extra == 'api'" }, @@ -2752,7 +2753,6 @@ requires-dist = [ { name = "passlib", extras = ["bcrypt"], marker = "extra == 'api'" }, { name = "pipmaster" }, { name = "pipmaster", marker = "extra == 'api'" }, - { name = "pre-commit", marker = "extra == 'evaluation'" }, { name = "pre-commit", marker = "extra == 'pytest'" }, { name = "psutil", marker = "extra == 'api'" }, { name = "pycryptodome", marker = "extra == 'api'", specifier = ">=3.0.0,<4.0.0" }, @@ -2764,9 +2764,7 @@ requires-dist = [ { name = "pypdf", marker = "extra == 'api'", specifier = ">=6.1.0" }, { name = "pypinyin" }, { name = "pypinyin", marker = "extra == 'api'" }, - { name = "pytest", marker = "extra == 'evaluation'", specifier = ">=8.4.2" }, { name = "pytest", marker = "extra == 'pytest'", specifier = ">=8.4.2" }, - { name = "pytest-asyncio", marker = "extra == 'evaluation'", specifier = ">=1.2.0" }, { name = "pytest-asyncio", marker = "extra == 'pytest'", specifier = ">=1.2.0" }, { name = "python-docx", marker = "extra == 'api'", specifier = ">=0.8.11,<2.0.0" }, { name = "python-dotenv" },