From 8a56a5ea6ccacda50b3df64f82792c6a8483a636 Mon Sep 17 00:00:00 2001 From: yangdx Date: Tue, 11 Feb 2025 16:11:15 +0800 Subject: [PATCH] fix: Add content column to doc status and fix SQL parameter indexing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • Add content column to doc status table • Fix SQL param index in get_by_status query • Update insert SQL to include content field --- lightrag/kg/postgres_impl.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lightrag/kg/postgres_impl.py b/lightrag/kg/postgres_impl.py index d319f6f9..5bd0a949 100644 --- a/lightrag/kg/postgres_impl.py +++ b/lightrag/kg/postgres_impl.py @@ -471,7 +471,7 @@ class PGDocStatusStorage(DocStatusStorage): self, status: DocStatus ) -> Dict[str, DocProcessingStatus]: """Get all documents by status""" - sql = "select * from LIGHTRAG_DOC_STATUS where workspace=$1 and status=$1" + sql = "select * from LIGHTRAG_DOC_STATUS where workspace=$1 and status=$2" params = {"workspace": self.db.workspace, "status": status} result = await self.db.query(sql, params, True) return { @@ -505,8 +505,8 @@ class PGDocStatusStorage(DocStatusStorage): Args: data: Dictionary of document IDs and their status data """ - sql = """insert into LIGHTRAG_DOC_STATUS(workspace,id,content_summary,content_length,chunks_count,status) - values($1,$2,$3,$4,$5,$6) + sql = """insert into LIGHTRAG_DOC_STATUS(workspace,id,content,content_summary,content_length,chunks_count,status) + values($1,$2,$3,$4,$5,$6,$7) on conflict(id,workspace) do update set content = EXCLUDED.content, content_summary = EXCLUDED.content_summary, @@ -1103,6 +1103,7 @@ TABLES = { "ddl": """CREATE TABLE LIGHTRAG_DOC_STATUS ( workspace varchar(255) NOT NULL, id varchar(255) NOT NULL, + content TEXT NULL, content_summary varchar(255) NULL, content_length int4 NULL, chunks_count int4 NULL,