Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/ecto/adapters/myxql/connection.ex
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ if Code.ensure_loaded?(MyXQL) do
defp distinct(%ByExpr{expr: false}, _sources, _query), do: []

defp distinct(%ByExpr{expr: exprs}, _sources, query) when is_list(exprs) do
error!(query, "DISTINCT with multiple columns is not supported by MySQL")
error!(query, "To apply DISTINCT to multiple columns at once, use distinct: true")
end

defp select([], _sources, _query),
Expand Down
4 changes: 2 additions & 2 deletions test/ecto/adapters/myxql_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ defmodule Ecto.Adapters.MyXQLTest do
assert all(query) == ~s{SELECT s0.`x`, s0.`y` FROM `schema` AS s0}

assert_raise Ecto.QueryError,
~r"DISTINCT with multiple columns is not supported by MySQL",
~r"To apply DISTINCT to multiple columns at once, use distinct: true",
fn ->
query =
Schema |> distinct([r], [r.x, r.y]) |> select([r], {r.x, r.y}) |> plan()
Expand All @@ -394,7 +394,7 @@ defmodule Ecto.Adapters.MyXQLTest do
end

assert_raise Ecto.QueryError,
~r"DISTINCT with multiple columns is not supported by MySQL",
~r"To apply DISTINCT to multiple columns at once, use distinct: true",
fn ->
query =
from(row in Schema, as: :r, select: row.x)
Expand Down