GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Support BooleanExpr join ons by lukaszsamson · Pull Request #748 · elixir-ecto/ecto_sql

Conversation

@lukaszsamson

@lukaszsamson lukaszsamson commented Jul 25, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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.

All reactions
@josevalim

josevalim commented Jul 26, 2026

Copy link
Copy Markdown
Member

Can you merge the old PR into this one and do a mix deps.update ecto so CI passes? Thank you! ❤️

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lukaszsamson @claude
Support BooleanExpr join ons
9c6a0c4
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
lukaszsamson force-pushed the drop-join-on-booleanexpr-conversion branch from acbdce8 to 9c6a0c4 Compare July 27, 2026 16:26
@lukaszsamson lukaszsamson changed the title Drop manual QueryExpr to BooleanExpr conversion in using_join Support BooleanExpr join ons Jul 27, 2026
@lukaszsamson
lukaszsamson marked this pull request as ready for review July 27, 2026 16:26
@lukaszsamson

lukaszsamson commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@lukaszsamson lukaszsamson mentioned this pull request Jul 27, 2026
Do not assume JoinExpr.on is a QueryExpr #747
Closed
@josevalim
josevalim merged commit 8fa4390 into elixir-ecto:master Jul 27, 2026
10 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@josevalim

josevalim commented Jul 27, 2026

Copy link
Copy Markdown
Member

💚 💙 💜 💛 ❤️

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

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.

2 participants

@lukaszsamson @josevalim
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.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.