__Development Environment__
__Production Envrionment__
The process of running the app
mix deps.getmix deps.update --alliex -S mix phx.serverThe response i get is
$ mix desp.update --all
==> ecto
Compiling 55 files (.ex)
== 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
could not compile dependency :ecto, "mix compile" failed. You can recompile this dependency with "mix deps.compile ecto", update it with "mix deps.update ecto" or clean it with "mix deps.clean ecto"
Include code samples, errors and stacktraces if appropriate.
I understand ecto got an update to 3.4.5, i hoped this is a minor update so there should be no breaking changes.
I have also tested on Centos7 and results are the same.
Probably this expected and am missing something, would highly appreciate correction.
Lock ecto to 3.4.4 with {:ecto, ">= 3.4.4 and < 3.4.5"}
Can you please provide a failing query? I tried select: true locally and it works just fine.
Unfortunately i can't recreate this with ecto 3.4.5, I created a new mix project, added ecto 3.4.5, but i can not go past the compiling ecto error, this is the current elixir version am running
Erlang/OTP 22 [erts-10.4] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [hipe]
Elixir 1.10.2 (compiled with Erlang/OTP 22)
Could you run rm -rf deps _build and try again?
Also, since you have this failure when compiling Ecto, this should also be a way to surface the problem:
git clone [email protected]:elixir-ecto/ecto && cd ecto && mix deps.get && mix compile
This is really weird, I cannot reproduce this error either and I tried on Elixir 1.10.2 too.
Oh, you already tried on a new project.
git clone [email protected]:elixir-ecto/ecto && cd ecto && mix deps.get && mix compile
..got same results.
what's your OTP version? Could you paste the output of mix hex.info?
what's your OTP version? Could you paste the output of
mix hex.info?
15:10 $ mix hex.info
Hex: 0.20.4
Elixir: 1.9.4
OTP: 22.0
Built with: Elixir 1.9.4 and OTP 20.3
I can also confirm that Ecto is broken after the upgrade:
$ elixir --version
Erlang/OTP 22 [erts-10.4] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]
Elixir 1.9.0 (compiled with Erlang/OTP 22)
Errors:
$ mix test
...
==> ecto
Compiling 55 files (.ex)
== 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
could not compile dependency :ecto, "mix compile" failed. You can recompile this dependency with "mix deps.compile ecto", update it with "mix deps.update ecto" or clean it with "mix deps.clean ecto"
Thanks you both for reporting and confirming this. This is bug in OTP 22.0 and 22.0.1 around guards handling and it since has been fixed in OTP 22.0.2. It is strongly recommended that you upgrade to at least 22.0.2 as your application might be silently broken.
I was able to verify it like this:
% docker run -it hexpm/elixir:1.9.4-erlang-22.0.1-ubuntu-bionic-20200219 elixir -e 'defmodule M do def f(atom) when is_atom(atom) and not is_boolean(atom) and atom != nil, do: :bug; def f(_other), do: :ok end; IO.inspect M.f(true)'
:bug
% docker run -it hexpm/elixir:1.9.4-erlang-22.0.2-ubuntu-bionic-20200219 elixir -e 'defmodule M do def f(atom) when is_atom(atom) and not is_boolean(atom) and atom != nil, do: :bug; def f(_other), do: :ok end; IO.inspect M.f(true)'
:ok
Awsome stuff, thanks guys!
Just created a brand new project with
mix phx.new tzipper --live --database mysql
went to directory tzipper, did a
mix ecto.create
and got this:
D:\repos\tzipper [master ≡ +9 ~1 -0 !]> mix ecto.create
==> ecto
Compiling 55 files (.ex)
== 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 1.10.2) expanding macro: Kernel.|>/2
lib/ecto/changeset.ex:1849: Ecto.Changeset.unsafe_validate_unique/4
(elixir 1.10.2) expanding macro: Kernel.if/2
lib/ecto/changeset.ex:1841: Ecto.Changeset.unsafe_validate_unique/4
could not compile dependency :ecto, "mix compile" failed. You can recompile this dependency with "mix deps.compile ecto", update it with "mix deps.update ecto" or clean it with "mix deps.clean ecto"
Upgrading Erlang to the latest (as of July-1-2020) 23.0.1 fixed it.
I encountered this in my Travis CI pipeline today. Bumping up the otp_release to 23.0 fixed it:
language: elixir
elixir: '1.10.3'
otp_release: '23.0'
Note that OTP 23 is not currently listed in https://hexdocs.pm/elixir/v1.10/%20/compatibility-and-deprecations.html - I don’t know if this means it’s not recommended or if it just means Elixir doesn’t make use of any new features.
v1.10.3 supports it, we just haven't published a new version of the page yet. :)
v1.10.3 supports it, we just haven't published a new version of the page yet. :)
Most helpful comment
Thanks you both for reporting and confirming this. This is bug in OTP 22.0 and 22.0.1 around guards handling and it since has been fixed in OTP 22.0.2. It is strongly recommended that you upgrade to at least 22.0.2 as your application might be silently broken.
I was able to verify it like this: