Skip to content

Commit 2914fd6

Browse files
committed
fix: don't wrap in subquery if in a lateral join
fixes #228
1 parent 0efc378 commit 2914fd6

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

lib/aggregate.ex

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ defmodule AshSql.Aggregate do
112112

113113
query =
114114
if (query.limit || query.offset || query.distinct) && root_data_path == [] && select? &&
115+
!query.__ash_bindings__[:lateral_join?] &&
115116
Enum.any?(
116117
remaining_aggregates,
117118
&(not optimizable_first_aggregate?(resource, &1, query))

0 commit comments

Comments
 (0)