Skip to content

Hardcoded binding fails add_aggregates #225

@StephanH90

Description

@StephanH90

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

ash_sql 0.3.16

Operating system

ubuntu

Current Behavior

When the parent resource has a primary key of integer but the joined resource that is being used for the aggregate has a different type for the primary key such as an uuid it fails.

I think the reason is this line:

# lib/sort.ex:166
case AshSql.Aggregate.add_aggregates(query, used_aggregates, resource, false, 0) do # `0` instead of `binding`

This function receives binding. If I change this to binding instead of 0 the aggregate works fine in my project. Is there a reason why this is 0?

Reproduction

I could only reproduce this in a project using ash_postgres but I think this is the underlying issue.

Expected Behavior

No response

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