Skip to content

fix(postgrest): align rpc maybe_single with select - #1555

Open
joaompneves wants to merge 2 commits into
supabase:mainfrom
godojoai:fix/rpc-maybe-single
Open

fix(postgrest): align rpc maybe_single with select#1555
joaompneves wants to merge 2 commits into
supabase:mainfrom
godojoai:fix/rpc-maybe-single

Conversation

@joaompneves

Copy link
Copy Markdown

Summary

  • Make rpc().maybe_single() use the same MaybeSingleRequestBuilder path as select().maybe_single(), instead of setting Accept: application/vnd.pgrst.object+json
  • Zero-row RPC results now return None instead of raising an APIError, matching select behavior (follows fix(postgrest): fix maybe_single #1424)
  • Add sync/async integration tests for match and no-match RPC maybe_single cases

Fixes the remaining gap from #1107 / #1207 where select was fixed but RPC still used the old Accept-header approach.

Test plan

  • test_rpc_with_maybe_single passes (sync + async)
  • test_rpc_with_maybe_single_no_match returns None (sync + async)
  • Existing test_rpc_with_single and select maybe_single tests still pass

Made with Cursor

Use MaybeSingleRequestBuilder for RPC instead of the Accept
object+json header, so zero-row results return None like select.

Co-authored-by: Cursor <cursoragent@cursor.com>
@joaompneves
joaompneves requested review from a team and o-santi as code owners July 31, 2026 08:36
Assert select and rpc raise APIError 406 when more than one row
is returned, for both sync and async builders.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant