Skip to content

chore(postgrest): clarify count behaviour with pagination methods#2056

Merged
mandarini merged 1 commit into
supabase:masterfrom
7ttp:chore/clarify-count-pagination-behavior
Jan 26, 2026
Merged

chore(postgrest): clarify count behaviour with pagination methods#2056
mandarini merged 1 commit into
supabase:masterfrom
7ttp:chore/clarify-count-pagination-behavior

Conversation

@7ttp

@7ttp 7ttp commented Jan 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds TSDoc clarification to the select() method explaining that count with pagination methods returns the total number of matching rows, not the paginated count.

Problem

Users reported that count appears to "ignore" .range() filters, expecting count to match data.length when using pagination. However, this is the intended behavior, not a bug.

The confusion arises because:

  • data.length returns the number of rows in the current page (e.g., 10)
  • count returns the total number of matching rows across all pages (e.g., 100)

Solution

Added @remarks to the select() method TSDoc clarifying that when using count with .range() or .limit(), the returned count represents the total number of rows matching your filters (before pagination).
This is the intended behavior to enable building pagination UI like "Showing 1-10 of 100 results".

Related

Summary by CodeRabbit

  • Documentation
    • Clarified documentation for count operations when used with pagination or limit parameters, specifying that the count reflects the total number of rows matching filters rather than just the returned subset.

✏️ Tip: You can customize this high-level summary in your review settings.

@7ttp 7ttp requested review from a team as code owners January 25, 2026 05:50
@coderabbitai

coderabbitai Bot commented Jan 25, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

A JSDoc remarks block was added to the select method in PostgrestQueryBuilder.ts to document that the count value returned when using range or limit reflects the total number of rows matching the applied filters, not just the current page subset.

Changes

Cohort / File(s) Summary
Documentation clarification
packages/core/postgrest-js/src/PostgrestQueryBuilder.ts
Added JSDoc remarks block to select method documenting count behavior with range and limit operations

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A count that counts the whole, not parts so small,
When range and limit dance, we've clarified it all!
The docs now sing of total rows that pass the test,
No more confusion—documentation's best! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding documentation to clarify count behavior with pagination methods in PostgREST.
Linked Issues check ✅ Passed The PR addresses issue #1275 by documenting the intended behavior that count returns total matching rows while data returns paginated subset.
Out of Scope Changes check ✅ Passed All changes are in scope: the PR only adds JSDoc documentation to the select method, directly addressing the confusion reported in issue #1275.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@mandarini mandarini merged commit 37ebe5e into supabase:master Jan 26, 2026
23 checks passed
@7ttp 7ttp deleted the chore/clarify-count-pagination-behavior branch January 27, 2026 08:43
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.

SDK returns incorrect value of count but data correctly filtered by range() and is()

3 participants