Skip to content

Test offset-only aggregate queries - #1

Draft
wtsnz wants to merge 1 commit into
mainfrom
test/lateral-offset-only-aggregates
Draft

Test offset-only aggregate queries#1
wtsnz wants to merge 1 commit into
mainfrom
test/lateral-offset-only-aggregates

Conversation

@wtsnz

@wtsnz wtsnz commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add a Postgres regression test for an ordered, offset-only aggregate query.
  • Assert that the aggregate sees only the rows after the offset.

Problem

The shared AshSQL lateral query path did not wrap aggregate inputs that had an offset and no limit. Postgres had no coverage that distinguished the offset row set from the full ordered input.

Dependency

This test depends on wtsnz/ash_sql#2. It is separate from the grouped aggregate extraction.

Validation

  • mix format --check-formatted
  • MIX_ENV=test ASH_SQL_VERSION=local mix test test/aggregate_test.exs:29
  • 1 test passed; 79 tests were excluded by the line filter.

Problem:
The shared AshSQL lateral query path did not wrap an aggregate input that had an offset without a limit. Postgres coverage did not distinguish the offset result set from the full ordered input.

Change:
Create three ordered posts, offset the first post, and assert that the aggregate count sees only the remaining two records.

Provenance:
This regression covers an existing AshSQL bug and depends on the `fix/lateral-offset-only-aggregates` follow-up branch. It is separate from the grouped aggregate extraction.
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.

1 participant