From 3d394740ced240153999fef0e322f522c85afa4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Menezes?= <77670471+menezesandre@users.noreply.github.com> Date: Mon, 12 May 2025 14:34:56 +0100 Subject: [PATCH] Fix AsyncPostgresStore._cursor row type (#4623) `AsyncPostgresStore._cursor` is expected to yield `AsyncCursor[DictRow]`. In the `else` branch the `row_factory` was not defined, meaning that it would yield `AsyncCursor[TupleRow]` (default). This resulted in an error in [langgraph/store/postgres/aio.py#L249](https://github.com/langchain-ai/langgraph/blob/main/libs/checkpoint-postgres/langgraph/store/postgres/aio.py#L249) (`TypeError: tuple indices must be integers or slices, not str`). --- libs/checkpoint-postgres/langgraph/store/postgres/aio.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/checkpoint-postgres/langgraph/store/postgres/aio.py b/libs/checkpoint-postgres/langgraph/store/postgres/aio.py index 7680d0154..22d15ee5f 100644 --- a/libs/checkpoint-postgres/langgraph/store/postgres/aio.py +++ b/libs/checkpoint-postgres/langgraph/store/postgres/aio.py @@ -558,6 +558,6 @@ class AsyncPostgresStore(AsyncBatchedBaseStore, BasePostgresStore[_ainternal.Con else: async with ( self.lock, - conn.cursor(binary=True) as cur, + conn.cursor(binary=True, row_factory=dict_row) as cur, ): yield cur