From d8a9617c0e6fc6e6e9fa1408552e4dec57b55a5a Mon Sep 17 00:00:00 2001 From: kevinnkansah Date: Mon, 6 Oct 2025 00:36:25 +0200 Subject: [PATCH] fix: fix: asyncpg bouncer connection pool error Prepared statement caching is disabled by setting `statement_cache_size=0` in the `asyncpg` connection pool parameters. This is necessary to prevent `asyncpg.exceptions.InvalidSQLStatementNameError` when using transaction-level connection poolers like Supabase Supavisor or pgbouncer, which do not support prepared statements. --- lightrag/kg/postgres_impl.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lightrag/kg/postgres_impl.py b/lightrag/kg/postgres_impl.py index 37b39b49..8fc9d590 100644 --- a/lightrag/kg/postgres_impl.py +++ b/lightrag/kg/postgres_impl.py @@ -161,6 +161,7 @@ class PostgreSQLDB: "port": self.port, "min_size": 1, "max_size": self.max, + "statement_cache_size": 0, } # Add SSL configuration if provided