Skip to content

Commit

Permalink
fix: don't double add distinct clauses
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed Oct 28, 2024
1 parent 474d804 commit e94aeab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/data_layer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1097,6 +1097,8 @@ defmodule AshPostgres.DataLayer do
where: ^source_filter
)

data_layer_query = Ecto.Query.exclude(data_layer_query, :distinct)

if query.__ash_bindings__[:__order__?] do
{:ok,
from(source in data_layer_query,
Expand Down Expand Up @@ -1186,6 +1188,8 @@ defmodule AshPostgres.DataLayer do
)
)

data_layer_query = Ecto.Query.exclude(data_layer_query, :distinct)

{:ok,
from(source in data_layer_query,
where: field(source, ^source_attribute) in ^source_values,
Expand Down Expand Up @@ -1224,6 +1228,8 @@ defmodule AshPostgres.DataLayer do
)
)

data_layer_query = Ecto.Query.exclude(data_layer_query, :distinct)

{:ok,
from(source in data_layer_query,
where: field(source, ^source_attribute) in ^source_values,
Expand Down

0 comments on commit e94aeab

Please sign in to comment.