Hi,
We are using Ecto types, a query like this works just fine (using `Repo.all/1):
from n in FileSystem.Schema.FSNode,
where: n.fs_type == ^FileSystem.Node.Type.file
This however using a named binding causes the cast to fail with a Postgrex
error. For example:
from n in FileSystem.Schema.FSNode, as: :node,
where: field(as(:node), :fs_type) == ^FileSystem.Node.Type.file
The error:
** (DBConnection.EncodeError) Postgrex expected an integer in -32768..32767, got %FileSystem.Node.Type{value: :file, db: 1}.
I have to manually cast the types.
Is there a workaround for this?
Thanks