Repository navigation
docs(database): maybe_single_row reports 200 and a null body for no row - #351
Merged
Merged
Conversation
A write that affects no row is answered with HTTP 406 and PGRST116, which the SDK resolves to Nothing. Say what an SDK that exposes the status or the body reports on that path: HTTP 200 and a JSON null body, not the 406 answer and its error body.
|
No actionable comments were generated in the recent review. Summary
Change: Other Merge Risk:
|
spydon
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
One sentence in
specs/database/using_modifiers/maybe_single_row.md, under Errors. When a write affects no row, PostgREST answers with HTTP 406 andPGRST116, and the SDK resolves to Nothing. An SDK that exposes the HTTP status or the body of a successful result now reports HTTP 200 and a JSONnullbody on that path, not the 406 answer and its error body.Why
Before this, the spec defined the value (Nothing) but not the status. supabase-swift resolved the value to
nilbut kept the 406 status and thePGRST116error body, so a caller that checked the status treated a valid empty result as a failure. supabase-js counts rows on the client, so its callers already see status 200 andnulldata here. This sentence makes that observable result the rule.Server behavior
PostgREST answers a single-object request that matches no row with 406,
PGRST116, and detailsThe result contains 0 rows: Error.hs#L123, #L164, #L213.Checks
bun run format-and-lintandbun run validatepass.Related: SDK-2913