Skip to content

Commit 4f4b407

Browse files
committed
chore: reproduce the bug reported in #185
1 parent 4d14204 commit 4f4b407

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/soft_delete_repo_test.exs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,16 @@ defmodule Ecto.SoftDelete.Repo.Test do
115115
assert Enum.member?(results, soft_deleted_user)
116116
end
117117

118+
test "handles subquery that does not expose deleted_at as 'main' schema" do
119+
Repo.insert!(%User{email: "[email protected]"})
120+
Repo.insert!(%Nondeletable{value: "stuff"})
121+
122+
subq = User |> where([u], u.email == "[email protected]") |> select([u], %{id: u.id, email: u.email})
123+
query = subquery(subq) |> join(:left, [u], nondel in Nondeletable, on: u.id == nondel.id)
124+
125+
Repo.all(query)
126+
end
127+
118128
test "includes soft deleted records if where not is_nil(deleted_at) clause is present" do
119129
user = Repo.insert!(%User{email: "[email protected]"})
120130

0 commit comments

Comments
 (0)