Closed ijcd closed 7 years ago
I think there's an issue with query generation (likely a macro?) that is breaking when pinned variables are passed in. When something like this is run:
require Ecto.Query lim = 5 off = 0 Web.Link |> Ecto.Query.limit(^lim) |> Ecto.Query.offset(^off) |> Web.Repo.all
An error response is generated from the RethinkDB adapter:
{:error, "Expected type NUMBER but found ARRAY."}
This is because the query is run with params instead of numbers in place. So this:
["prepared", {:nocache, {:all, #Ecto.Query<from l in Web.Link, limit: ^..., offset: ^..., select: l>}}] ["params", [5, 0]]
Instead of this:
["prepared", {:nocache, {:all, #Ecto.Query<from l in Web.Link, limit: 5, offset: 0, select: l>}}] ["params", []]
The root cause seems to be that the query generated for RethinkDB to run is this:
["query", %RethinkDB.Q{message: nil, query: [71, [%RethinkDB.Q{message: nil, query: [70, [%RethinkDB.Q{message: nil, query: [15, ["links"]]}, %RethinkDB.Q{message: nil, query: [2, [:^, %RethinkDB.Q{message: nil, query: [2, []]}, %RethinkDB.Q{message: nil, query: [2, [1]]}]]}]]}, %RethinkDB.Q{message: nil, query: [2, [:^, %RethinkDB.Q{message: nil, query: [2, []]}, %RethinkDB.Q{message: nil, query: [2, [0]]}]]}]]}]
Instead of something like this:
["query", %RethinkDB.Q{message: nil, query: [71, [%RethinkDB.Q{message: nil, query: [70, [%RethinkDB.Q{message: nil, query: [15, ["links"]]}, 0]]}, 5]]}]
It looks like a macro somewhere isn't considering that there could be pinned values/params in play.
Oops. I meant to file this on the other repo. Closing.
I think there's an issue with query generation (likely a macro?) that is breaking when pinned variables are passed in. When something like this is run:
An error response is generated from the RethinkDB adapter:
This is because the query is run with params instead of numbers in place. So this:
Instead of this:
The root cause seems to be that the query generated for RethinkDB to run is this:
Instead of something like this:
It looks like a macro somewhere isn't considering that there could be pinned values/params in play.