Skip to content

Aggregate count regression introduced in ash_sql #177

@codonnell

Description

@codonnell

Code of Conduct

  • I agree to follow this project's Code of Conduct

AI Policy

  • I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.

Versions

Erlang/OTP 27, Elixir 1.18.4. The regression was introduced in this commit, ash_sql 0.2.87. It is not present in 0.2.86. I verified this by running the test against a local ash_sql dependency. It passes when I revert the change in that commit.

Operating system

OS X 15.6.1

Current Behavior

I haven't untangled the exact mechanics, but there is an issue with how joins are generated for aggregates. In the failing test I wrote at ash-project/ash_postgres#622, the comment count is multiplied by the number of users in the organization. In that PR, there are two users, and the count is 2 instead of 1. If I add another user, the count will increase to 3.

Reproduction

ash-project/ash_postgres#622 has a test where the count should be 1, but is in fact 2. I ran it with mix test after setting up the test database.

Expected Behavior

The result of an aggregate count should be accurate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions