From 4474021767b1c3c7ad56a22ae854a827c60babba Mon Sep 17 00:00:00 2001 From: jeffersonsilva-mb Date: Tue, 15 Oct 2024 18:38:49 -0300 Subject: [PATCH] fix: PostgreSQL 17 gives a list instead of bytes --- taskiq_psqlpy/result_backend.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/taskiq_psqlpy/result_backend.py b/taskiq_psqlpy/result_backend.py index d53a146..8ad97b6 100644 --- a/taskiq_psqlpy/result_backend.py +++ b/taskiq_psqlpy/result_backend.py @@ -123,15 +123,16 @@ async def get_result( """ connection: Final = await self._database_pool.connection() try: - result_in_bytes = cast( - bytes, - await connection.fetch_val( + result_in_bytes: bytes | list = await connection.fetch_val( querystring=SELECT_RESULT_QUERY.format( self.table_name, ), parameters=[task_id], ), - ) + + if isinstance(result_in_bytes, list): + result_in_bytes = bytes(result_in_bytes) + except RustPSQLDriverPyBaseError as exc: raise ResultIsMissingError( f"Cannot find record with task_id = {task_id} in PostgreSQL",