Skip to content

docs(database): maybe_single_row reports 200 and a null body for no row - #351

Merged
grdsdev merged 1 commit into
mainfrom
guilhermesouza/maybe-single-status
Nov 11, 2026
Merged

grdsdev merged 1 commit into
mainfrom
guilhermesouza/maybe-single-status

Conversation

@grdsdev

@grdsdev grdsdev commented Nov 10, 2026

Copy link
Copy Markdown
Collaborator

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 and PGRST116, 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 JSON null body 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 nil but kept the 406 status and the PGRST116 error 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 and null data 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 details The result contains 0 rows: Error.hs#L123, #L164, #L213.

Checks

bun run format-and-lint and bun run validate pass.

Related: SDK-2913

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.
@grdsdev
grdsdev requested a review from a team as a code owner November 10, 2026 21:51
@coderabbitai

coderabbitai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • Documentation
    • Clarified that when a write returns HTTP 406 with PGRST116 because no rows were affected, SDKs that expose response status or body report HTTP 200 with a JSON null body instead of the server error response.
    • Other HTTP 406 responses from writes continue to be reported as errors.

The documentation now states that SDKs exposing response status or body report HTTP 200 with a JSON null body when a write returns HTTP 406 with PGRST116 for zero rows. Other write-side HTTP 406 responses remain errors.

Possibly related PRs

  • supabase/sdk#307: Documents maybe_single_row handling for zero-row writes with HTTP 406 and PGRST116.

Change: Other

Merge Risk: Minimal · up to 7e738

No actionable merge-blocking risk was identified in the documentation change.

- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ca0bce2d-dc88-4bc2-96b2-cffb174ffded
Commits

Reviewing files that changed from the base of the PR and between 07d5ae0 and 7e73855.

Files selected for processing: 1

  • packages/capability-matrix/specs/database/using_modifiers/maybe_single_row.md

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

@grdsdev
grdsdev merged commit 0f8e25f into main Nov 11, 2026
10 checks passed
@grdsdev
grdsdev deleted the guilhermesouza/maybe-single-status branch November 11, 2026 00:16
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