Skip to content

Commit f65f238

Browse files
committed
Add missing :on keys to queries with joins
1 parent f478b38 commit f65f238

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

test/ecto/adapters/sqlite3/connection_test.exs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
307307
from(c in "categories",
308308
as: :parent_category,
309309
left_lateral_join: b in subquery(breadcrumbs_query),
310+
on: true,
310311
select: %{id: c.id, breadcrumbs: b.breadcrumbs}
311312
)
312313
|> plan()
@@ -1409,7 +1410,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
14091410
test "join with hints" do
14101411
assert_raise Ecto.QueryError, ~r/join hints are not supported by SQLite3/, fn ->
14111412
Schema
1412-
|> join(:inner, [p], q in Schema2, hints: ["USE INDEX FOO", "USE INDEX BAR"])
1413+
|> join(:inner, [p], q in Schema2, hints: ["USE INDEX FOO", "USE INDEX BAR"], on: true)
14131414
|> select([], true)
14141415
|> plan()
14151416
|> all()
@@ -1475,7 +1476,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
14751476
query =
14761477
"comments"
14771478
|> from(as: :comment)
1478-
|> join(:inner, [c], p in subquery(posts))
1479+
|> join(:inner, [c], p in subquery(posts), on: true)
14791480
|> select([_, p], p)
14801481
|> plan()
14811482

@@ -1519,7 +1520,8 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
15191520
"SELECT * FROM schema2 AS s2 WHERE s2.id = ? AND s2.field = ?",
15201521
p.x,
15211522
^10
1522-
)
1523+
),
1524+
on: true
15231525
)
15241526
|> select([p], {p.id, ^0})
15251527
|> where([p], p.id > 0 and p.id < ^100)
@@ -1545,7 +1547,7 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
15451547

15461548
test "join with query interpolation" do
15471549
inner = Ecto.Queryable.to_query(Schema2)
1548-
query = from(p in Schema, left_join: c in ^inner, select: {p.id, c.id}) |> plan()
1550+
query = from(p in Schema, left_join: c in ^inner, on: true, select: {p.id, c.id}) |> plan()
15491551

15501552
assert all(query) ==
15511553
"SELECT s0.\"id\", s1.\"id\" FROM \"schema\" AS s0 LEFT OUTER JOIN \"schema2\" AS s1 ON 1"
@@ -1561,7 +1563,8 @@ defmodule Ecto.Adapters.SQLite3.ConnectionTest do
15611563
"SELECT * FROM schema2 AS s2 WHERE s2.id = ? AND s2.field = ?",
15621564
p.x,
15631565
^10
1564-
)
1566+
),
1567+
on: true
15651568
)
15661569
|> select([p, q], {p.id, q.z})
15671570
|> where([p], p.id > 0 and p.id < ^100)

0 commit comments

Comments
 (0)