Skip to content

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

Merged
o-santi merged 2 commits into
supabase:mainfrom
godojoai:fix/rpc-maybe-single
Aug 3, 2026
Merged

o-santi merged 2 commits into
supabase:mainfrom
godojoai:fix/rpc-maybe-single

Conversation

@joaompneves

Copy link
Copy Markdown
Contributor

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 <[email protected]>
@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 <[email protected]>
@o-santi
o-santi merged commit 0490201 into supabase:main Aug 3, 2026
42 of 43 checks passed
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.

2 participants