From 3c2b8912d0099b05911117995e63e3ef4f5691a9 Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Thu, 7 Mar 2024 11:33:23 -0500 Subject: [PATCH] fix: don't reuse binding in many to many aggregate joins --- lib/aggregate.ex | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/aggregate.ex b/lib/aggregate.ex index 1582d8c..71d69c9 100644 --- a/lib/aggregate.ex +++ b/lib/aggregate.ex @@ -209,6 +209,9 @@ defmodule AshPostgres.Aggregate do ^first_relationship.source_attribute_on_join_resource ) ) + |> Map.update!(:__ash_bindings__, fn bindings -> + Map.update!(bindings, :current, &(&1 + 1)) + end) AshPostgres.Join.set_join_prefix( subquery,