Skip to content

Commit

Permalink
make tds connection raise errors on using subqueries in forbidden cases
Browse files Browse the repository at this point in the history
  • Loading branch information
zachdaniel committed May 28, 2024
1 parent 4b51f0a commit f3e75d5
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 103 deletions.
2 changes: 2 additions & 0 deletions integration_test/sql/subquery.exs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ defmodule Ecto.Integration.SubQueryTest do
end

@tag :multicolumn_distinct
@tag :subquery_in_distinct
test "subqueries in distinct" do
TestRepo.insert!(%Post{visits: 10, title: "hello1"})
TestRepo.insert!(%Post{visits: 10, title: "hello2"})
Expand All @@ -133,6 +134,7 @@ defmodule Ecto.Integration.SubQueryTest do
assert [%{title: "hello"}, %{title: "hello1"}] = TestRepo.all(query)
end

@tag :subquery_in_group_by
test "subqueries in group by" do
TestRepo.insert!(%Post{visits: 10, title: "hello1"})
TestRepo.insert!(%Post{visits: 10, title: "hello2"})
Expand Down
7 changes: 5 additions & 2 deletions integration_test/tds/test_helper.exs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,11 @@ ExUnit.start(
:selected_as_with_order_by_expression,
# MSSQL doesn't support specifying columns for ON DELETE SET NULL
:on_delete_nilify_column_list,
# MySQL doesnt' support anything except a single column in DISTINCT
:multicolumn_distinct
# MSSQL doesnt' support anything except a single column in DISTINCT
:multicolumn_distinct,
# MSSQL doesnt' support subqueries in group by or in distinct
:subquery_in_group_by,
:subquery_in_distinct
]
)

Expand Down
Loading

0 comments on commit f3e75d5

Please sign in to comment.