Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FunctionClauseError after Ecto v3.12 update #146

Closed
sorentwo opened this issue Aug 13, 2024 · 4 comments
Closed

FunctionClauseError after Ecto v3.12 update #146

sorentwo opened this issue Aug 13, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@sorentwo
Copy link

The recent Ecto v3.12 update seems to have broken distinct queries. Here's a full stacktrace, taken from the dependabot update to the Oban repo:

** (FunctionClauseError) no function clause matching in Ecto.Adapters.SQLite3.Connection.distinct/3
    (ecto_sqlite3 0.16.0) lib/ecto/adapters/sqlite3/connection.ex:846: Ecto.Adapters.SQLite3.Connection.distinct(%Ecto.Query.ByExpr{expr: true, file: "/home/runner/work/oban/oban/lib/oban/engines/basic.ex", line: 178, params: nil, subqueries: []}, {{[[34, "oban_jobs", 34]], [111 | "0"], Oban.Job}, []}, #Ecto.Query<from j0 in Oban.Job, where: j0.state == "available", where: not is_nil(j0.queue), distinct: true, select: j0.queue>)
    (ecto_sqlite3 0.16.0) lib/ecto/adapters/sqlite3/connection.ex:859: Ecto.Adapters.SQLite3.Connection.select/2
    (ecto_sqlite3 0.16.0) lib/ecto/adapters/sqlite3/connection.ex:178: Ecto.Adapters.SQLite3.Connection.all/2
    (ecto_sqlite3 0.16.0) lib/ecto/adapters/sqlite3.ex:187: Ecto.Adapters.SQLite3.prepare/2
    (ecto 3.12.0) lib/ecto/query/planner.ex:202: Ecto.Query.Planner.query_without_cache/4
    (ecto 3.12.0) lib/ecto/query/planner.ex:170: Ecto.Query.Planner.query_prepare/6
    (ecto 3.12.0) lib/ecto/query/planner.ex:143: Ecto.Query.Planner.query_with_cache/8
    (ecto 3.12.0) lib/ecto/repo/queryable.ex:214: Ecto.Repo.Queryable.execute/4
    (ecto 3.12.0) lib/ecto/repo/queryable.ex:19: Ecto.Repo.Queryable.all/3
    (oban 2.18.0) lib/oban/engines/basic.ex:180: Oban.Engines.Basic.check_available/1
    (oban 2.18.0) lib/oban/engine.ex:264: anonymous fn/2 in Oban.Engine.check_available/1
    (oban 2.18.0) lib/oban/engine.ex:339: anonymous fn/3 in Oban.Engine.with_span/4
    (telemetry 1.2.1) /home/runner/work/oban/oban/deps/telemetry/src/telemetry.erl:321: :telemetry.span/3
    (oban 2.18.0) lib/oban/stager.ex:88: Oban.Stager.notify_queues/1
    (oban 2.18.0) lib/oban/stager.ex:73: anonymous fn/1 in Oban.Stager.stage_and_notify/2
    (ecto_sql 3.12.0) lib/ecto/adapters/sql.ex:1382: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4
    (db_connection 2.7.0) lib/db_connection.ex:1756: DBConnection.run_transaction/4
    (oban 2.18.0) lib/oban/repo.ex:156: Oban.Repo.transaction/4
    (oban 2.18.0) lib/oban/stager.ex:70: Oban.Stager.stage_and_notify/2
    (oban 2.18.0) lib/oban/stager.ex:57: anonymous fn/2 in Oban.Stager.handle_info/2

Here's a link to the failing CI run: https://github.com/sorentwo/oban/actions/runs/10359975065/job/28677500392?pr=1135

@warmwaffles
Copy link
Member

Yea I think I remember seeing something upstream about the distinct changes. I'll try to get this resolved soon.

@warmwaffles
Copy link
Member

Leaving this here for later elixir-ecto/ecto_sql#607

@warmwaffles warmwaffles self-assigned this Aug 13, 2024
@warmwaffles warmwaffles added the bug Something isn't working label Aug 13, 2024
warmwaffles added a commit that referenced this issue Aug 14, 2024
@warmwaffles
Copy link
Member

Fix released under v0.17.0

@sorentwo
Copy link
Author

I can confirm that fixed the issue and got the upgrade passing. Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants