Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

count always runs on the whole table #190

Closed
soedirgo opened this issue Jun 11, 2021 · 2 comments
Closed

count always runs on the whole table #190

soedirgo opened this issue Jun 11, 2021 · 2 comments
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@soedirgo
Copy link
Member

soedirgo commented Jun 11, 2021

Bug report

Describe the bug

The count field on the response always represents the whole table despite filtering etc. This is because it's retrieved from Prefer: count={exact|estimated|planned}. It should instead come from Content-Range without the prefer count parameter.

To Reproduce

  1. Run a .from().select().limit(1)
  2. Check the count (it's not 0 or 1).

Expected behavior

It should be 0 or 1.

Additional context

For now we should just let count represent the right value—for supabase-js v2 we should use the Prefer: count parameter in a dedicated count call and maybe rpc().

@soedirgo soedirgo added the bug Something isn't working label Jun 11, 2021
@dshukertjr
Copy link
Member

I think a typical use case of count is for pagination, so it would make sense to respect filters like match or eq, but I wonder if count should respect modifiers like limit or range.

When I tested it, count did respect filters, but ignored modifiers, which feels like the desired behavior!

@soedirgo
Copy link
Member Author

Yup, I can't repro the issue anymore either. Thanks for looping back in!

@egor-romanov egor-romanov added the wontfix This will not be worked on label Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants