Open ssomnoremac opened 7 years ago
Hi @ssomnoremac this is definitely a bug.
Will write some unit tests in mssqlex
to reproduce it and see where I can go from there.
Hi @ssomnoremac I tried to replicate your issue with a test in mssqlex
and it passed.
Can you take a look at the PR and confirm if the PR adequately tests your scenario:
Thanks @shdblowers , those tests look good except for not having the joins. Don't know how that could change the behavior. I can try to apply the same WHERE IN
to various other queries and let you know if I see the same error.
you get the same issue if you do something like this , the variables in the generated sql also get missaligned:
` test_values = [2,4,5,6]
more_test_values = [7,8,9,10]
Repo.all(
from a in ItemA,
join: b in ItemB,
on: a.id == b.id,
where: a.test in ^test_values and a.other_vals in ^more_test_values,
select: a
)`
I have a query like so which I'm passing an array of ids and a string
If I pass a single value array, it works:
Expected Behavior
The last part is most relevant. However, as soon as I pass a second item to the array the variable insertion seems to misalign
Actual Behavior
My database thinks that "US" is being passed to the "state_id" IN(?,?) clause.
Unless I'm missing something, it seems not to be behaving correctly.
Possible Solution
it works to reverse the where clauses
Your Environment
latest