Update postgres_impl.py

There is aBUG. When lighttrag uses the postgres@15 version, there will be an error.The BUG detail as follow:
PostgreSQL database, error:subquery in FROM must have an alias
HINT:  For example, FROM (SELECT ...) [AS] foo.
It roughly means that there is an error in SQL template, and you need to use the alias alias to declare the content of the subquery.
This commit is contained in:
pengjunfeng11
2025-03-17 10:47:17 +08:00
committed by GitHub
parent a9bd318d98
commit 4e58c7d7da

View File

@@ -1739,7 +1739,7 @@ SQL_TEMPLATES = {
FROM LIGHTRAG_VDB_ENTITY FROM LIGHTRAG_VDB_ENTITY
where workspace=$1 where workspace=$1
AND chunk_id IN (SELECT chunk_id FROM relevant_chunks) AND chunk_id IN (SELECT chunk_id FROM relevant_chunks)
) ) as chunk_distances
WHERE distance>$2 WHERE distance>$2
ORDER BY distance DESC ORDER BY distance DESC
LIMIT $3 LIMIT $3
@@ -1756,7 +1756,7 @@ SQL_TEMPLATES = {
FROM LIGHTRAG_DOC_CHUNKS FROM LIGHTRAG_DOC_CHUNKS
where workspace=$1 where workspace=$1
AND id IN (SELECT chunk_id FROM relevant_chunks) AND id IN (SELECT chunk_id FROM relevant_chunks)
) ) as chunk_distances
WHERE distance>$2 WHERE distance>$2
ORDER BY distance DESC ORDER BY distance DESC
LIMIT $3 LIMIT $3