From a5efce6acd932b6a9922ccf4882ea79606f97175 Mon Sep 17 00:00:00 2001 From: Tushar Balwani <79524298+tushar-balwani@users.noreply.github.com> Date: Sat, 9 Sep 2023 00:25:29 +0530 Subject: [PATCH] fix: maybe_single with no matching rows returns None (#289) --- postgrest/_async/request_builder.py | 2 +- postgrest/_sync/request_builder.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/postgrest/_async/request_builder.py b/postgrest/_async/request_builder.py index c6536c7a..1835e335 100644 --- a/postgrest/_async/request_builder.py +++ b/postgrest/_async/request_builder.py @@ -127,7 +127,7 @@ async def execute(self) -> Optional[SingleAPIResponse]: try: r = await super().execute() except APIError as e: - if e.details and "Results contain 0 rows" in e.details: + if e.details and "The result contains 0 rows" in e.details: return None if not r: raise APIError( diff --git a/postgrest/_sync/request_builder.py b/postgrest/_sync/request_builder.py index c6bd57e3..05d42d77 100644 --- a/postgrest/_sync/request_builder.py +++ b/postgrest/_sync/request_builder.py @@ -127,7 +127,7 @@ def execute(self) -> Optional[SingleAPIResponse]: try: r = super().execute() except APIError as e: - if e.details and "Results contain 0 rows" in e.details: + if e.details and "The result contains 0 rows" in e.details: return None if not r: raise APIError(