Skip to content

Commit

Permalink
fix: simplify lateral join source
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Feb 5, 2025
1 parent 93d6cd7 commit a311224
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/query.ex
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ defmodule AshSql.Query do
[] ->
raise "Cannot use lateral joins with a resource that has no primary key and no identities"

[key] ->
Ash.Expr.expr(^Ash.Expr.ref(key) in ^Enum.map(records, &Map.get(&1, key)))

keys ->
Enum.reduce(records, Ash.Expr.expr(false), fn record, filter_expr ->
all_keys_match_expr =
Expand Down

0 comments on commit a311224

Please sign in to comment.