You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Database Adapter and Versions (postgrex, myxql, etc)
exqlite 0.23, ecto_sqlite3 0.17.0
Current behavior
The below query doing left joins is turned into multiple FROM clauses, which according to the sqlite docs stating they modeled it after postgres and postgres documenting it to be a cross join, would be a different kind of join.
UPDATE"qwer_projects"AS q0
SET"snapshots"= json_insert(CASE WHEN json_array_length(q0."snapshots") >=10 THEN json_remove(q0."snapshots",'$[0]') ELSE q0."snapshots" END,'$[#]',json_object('placeables',s1."json",'links',s2."json"))
FROM
(
SELECT json_group_array(json_object([...fields])) AS"json"FROM"qwer_placeables"AS sq0
WHERE (sq0."project_id"= ?)
GROUP BY TRUE
) AS s1,
(
SELECT json_group_array(json_object([...fields])) AS"json"FROM"qwer_links"AS sq0
WHERE (sq0."project_id"= ?)
GROUP BY TRUE
) AS s2
WHERE (q0."id"= ?)
Do you have a stub schema, some example rows, and the expected results update results?
In the mean time, I'll see if I can come up with a simpler reproduction of this problem without the json stuff. (although having that in the regression test wouldn't be a bad thing either)
Repo.insert_all("table", [%{number: 0}])
a = from x in fragment("json_each(?)", "[]"), select: %{value: x.value}
u =
from x in "table",
left_join: a in subquery(a), on: true,
update: [set: [number: coalesce(a.value, 1)]]
{1, _} = Repo.update_all(u, [])
This should be a quote simple example. Just needs a table with a number column. You could replace the subquery with a table having a value column (int), but being empty. Currently the update would result in no row updated, where it should.
Elixir version
1.17.2
Database and Version
sqlite 3 (as brought by adapter)
Ecto Versions
3.12.1
Database Adapter and Versions (postgrex, myxql, etc)
exqlite 0.23, ecto_sqlite3 0.17.0
Current behavior
The below query doing left joins is turned into multiple
FROM
clauses, which according to the sqlite docs stating they modeled it after postgres and postgres documenting it to be a cross join, would be a different kind of join.Expected behavior
The join semantics are retained.
Follow up to elixir-ecto/ecto#4502
The text was updated successfully, but these errors were encountered: