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

Issue: 'content-range' from response header with aggregation function #3800

Open
jeffoo713 opened this issue Nov 21, 2024 · 0 comments
Open
Labels

Comments

@jeffoo713
Copy link

Environment

  • PostgreSQL version: v14.12
  • PostgREST version: v12.2.3
  • Operating system: MacOS

Description of issue

Hi there, I'd like to report some buggy 'content-range' value in the response header with aggregation function.

  • Minimal SQL definition
CREATE TABLE employees (
    id SERIAL PRIMARY KEY,
    organization_id INTEGER,
    first_name VARCHAR,
    last_name VARCHAR,
    gender VARCHAR,
    status VARCHAR
);
  • How I make a request to Postgrest:
    http:<postgrest_url>/employees?limit=100&offset=0&and=(or(status.like.active))&select=count(),gender
  • The behaviour I expect:
    In the response header, "content-range" value should be '0-2/3'. There are only 3 gender values in DB: male, female, undisclosed.
  • The actual behaviour:
    In the response header, "content-range" value is '0-2/147'.
    I suspect the total number of record "147" is from the total number of records without aggregation.
    When I make a request without aggregation; http:<postgrest_url>/employees?limit=100&offset=0&and=(or(status.like.active)) I have '0-99/147' as "content-range" value in the response header.

Thank you in advance!

@jeffoo713 jeffoo713 changed the title Issue: 'content-range' from response header buggy with aggregation function Issue: 'content-range' from response header with aggregation function Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants