Skip to content

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

@jeffoo-k

Description

@jeffoo-k

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions