GeezerVison is showing github.com — Support BooleanExpr join ons by lukaszsamson · Pull Request #748 · elixir-ecto/ecto_sql
Conversation
Adapter side of elixir-ecto/ecto#4765 (fix for elixir-ecto/ecto#4763), which is now merged. Supersedes #747, whose changes are folded into this PR.
Ecto's join builder now emits every JoinExpr.on as a %BooleanExpr{op: :and} instead of a QueryExpr, so that wheres folded into the on of an interpolated join query (join: x in ^query) can carry subqueries. This matches on BooleanExpr when rendering joins, and drops the manual struct rewrite in the using_join comprehensions (Map.put(:__struct__, BooleanExpr) |> Map.put(:op, :and)), which now receive a real BooleanExpr.
Two failure modes without this change:
join/2 raises FunctionClauseError for any interpolated join query — loud.
- the
using_join comprehensions filtered joins by on: %QueryExpr{}, so they would silently drop the join conditions from the WHERE clause of update_all/delete_all — wrong SQL, no error. There was no coverage for interpolated join queries in update_all/delete_all, so this adds it for all three adapters.
mix deps.update ecto bumps the ecto git dep to 8959c439, which includes the change. Full suite passes (692 tests), along with mix format --check-formatted and mix deps.unlock --check-unused.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Can you merge the old PR into this one and do a mix deps.update ecto so CI passes? Thank you! ❤️
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Since elixir-ecto/ecto#4765, the join builder emits every JoinExpr.on
as a %BooleanExpr{op: :and} rather than a QueryExpr, so that wheres
folded into the on of an interpolated join query can carry subqueries.
Match on BooleanExpr when rendering joins, and drop the manual struct
rewrite in the using_join comprehensions, which now receive a real
BooleanExpr.
Without this, join/2 raises for interpolated join queries, and the
using_join comprehensions silently drop the join conditions from the
WHERE clause of update_all/delete_all, as they filtered joins by
on: %QueryExpr{}. Add coverage for interpolated join queries in
update_all/delete_all, which had none.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
lukaszsamson
changed the title
Drop manual QueryExpr to BooleanExpr conversion in using_join
Support BooleanExpr join ons
Jul 27, 2026
|
Done — #747 is folded in here (closed) and mix deps.update ecto bumps the git dep to 8959c439, which has #4765. Single commit now; mix test, mix format --check-formatted and mix deps.unlock --check-unused all pass locally.
Since ecto master always emits BooleanExpr ons, I also tightened the join matches to %BooleanExpr{} rather than keeping the permissive map patterns #747 used for cross-version compatibility.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|