Drop manual QueryExpr to BooleanExpr conversion in using_join#748
Draft
lukaszsamson wants to merge 2 commits into
Draft
Drop manual QueryExpr to BooleanExpr conversion in using_join#748lukaszsamson wants to merge 2 commits into
lukaszsamson wants to merge 2 commits into
Conversation
Ecto is changing interpolated join queries (join: x in ^query) to carry their "on" expression as a BooleanExpr instead of a QueryExpr, since folded wheres may hold subqueries (elixir-ecto/ecto#4765). Relax the join.on pattern matches to the map shape so both structs are accepted. This matters beyond the crash in join/2: the using_join comprehensions filtered joins by on: %QueryExpr{}, so a BooleanExpr "on" would have been silently dropped from the WHERE clause of update_all/delete_all. Add coverage for interpolated join queries in update_all/delete_all, which previously had none. The relaxed patterns remain compatible with current Ecto releases. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Since elixir-ecto/ecto#4765, every JoinExpr.on is a BooleanExpr with op :and, so the using_join comprehensions no longer need to rewrite the struct by hand before appending the join conditions to WHERE. This requires ecto with the above change and must only ship once the minimum ecto version is bumped accordingly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Member
|
Can you merge the old PR into this one and do a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #747 (the first commit here is that PR); only the last commit is new.
Once elixir-ecto/ecto#4765 ships, every
JoinExpr.onis a real%BooleanExpr{op: :and}, so theusing_joincomprehensions' hand-conversion (Map.put(:__struct__, BooleanExpr) |> Map.put(:op, :and)) becomes a no-op. This drops it and tightens the comprehension matches to%BooleanExpr{}.Blocked on the ecto release: unlike #747 (compatible both ways), this branch requires the new ecto — against released ecto 3.14 the stricter match would skip
QueryExprons (15 test failures, verified). Merge only after #747, once the ecto change is released and the minimum ecto version here is bumped. Full suite passes (685 tests) against the ecto PR branch viaECTO_PATH.🤖 Generated with Claude Code