Closed tjchambers closed 1 year ago
BTW - I do feel as though I can work around this but I wanted to report it. Sorry for the complexity of the example.
Hi @tjchambers! 👋
I believe the query is correct? Bindings are positional, [ps, s]
will match the from and the join of the initial query. If you want to get the last join, you can do [ps, ..., s]
. Alternatively, use named bindings as outlined in Ecto.Query
docs. :)
Thanks - let me try that. I expected the unique alias s
to refer properly.
No, the variable names have no impact on that. We did like this on purpose to avoid accidental variable name clashing from unrelated parts of the code.
Ok - adding ...
got the "proper" reference. Thanks.
BTW - I absolutely am head over heels using dbg
.
Elixir version
Erlang/OTP 25 [erts-13.1] [source] [64-bit] [smp:32:32] [ds:32:32:10] [async-threads:1] [jit:ns] Elixir 1.14.3 (compiled with Erlang/OTP 23)
Database and Version
MySQL 8.0.30
Ecto Versions
ecto 3.9.4
Database Adapter and Versions (postgrex, myxql, etc)
myxql 0.6.3
Current behavior
There are two Queries that are composed that refer to the same table twice.
The resulting query that is constructed is logged as:
I have marked the line generating the incorrect relation above and the incorrect resulting reference to p1 instead of p3
Expected behavior
Expected that the query generated for the line indicated above should result in:
on: p3.role_id == r4.id
NOT
on: p1.role_id == r4.id