Ecto no longer compiles after upgrading to elang/OTP 22

Error message:

== Compilation error in file lib/ecto/changeset.ex ==
** (Ecto.Query.CompileError) true is not a valid query expression, :select expects a query expression or a list of fields

    expanding macro: Ecto.Query.select/2
    lib/ecto/changeset.ex:1848: Ecto.Changeset.unsafe_validate_unique/4
    expanding macro: Ecto.Query.limit/2
    lib/ecto/changeset.ex:1849: Ecto.Changeset.unsafe_validate_unique/4
    (elixir) expanding macro: Kernel.|>/2
    lib/ecto/changeset.ex:1849: Ecto.Changeset.unsafe_validate_unique/4
    (elixir) expanding macro: Kernel.if/2
    lib/ecto/changeset.ex:1841: Ecto.Changeset.unsafe_validate_unique/4

I’m running Elixir 1.8.1 and Erlang/OTP 22.0.
I have ecto_sql 3.4.4 and ecto 3.4.5 in mix.lock

Any assistance is welcome here. Thank you!

1 Like

Did you already try a rm -rf _build? When you switch erlang or elixir versions it’s a good practice to do a completely fresh compile.

This is a bug in OTP 22.0 and 22.0.1, please upgrade. See https://github.com/elixir-ecto/ecto/issues/3335#issuecomment-644201355 for more details.

6 Likes

Wow, thanks for the fast responses. I had already tried deleting both the _build and deps directories, but that didn’t work. Installing OTP 22.0.2 worked.