-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implicit conversion from data type varbinary to date is not allowed #124
Comments
@puruzio did you ever figure out a fix? We're running into the same issue |
I did some digging into this and wrote a failing test for it. The issue is caused by Tds.Parameter.fix_data_type/1 which casts a A quick way to almost fix this is to change the function linked above from I should caveat the following by saying that I know almost nothing about the guts of the TDS protocol. That being said, I believe the proper way to fix this is to introduce a I think we need to update Tds.Parameter.fix_data_type to introduce a null parameter type: def fix_data_type(%__MODULE__{type: nil, value: nil} = param) do
%{param | type: :null}
end Then add that Finally the real nitty gritty, Tds.Types.encode_data/3 will need to actually put that null type as bits on the wire, which I don't know how to do. I can hopefully dig into this a little more when I get some time, or otherwise, perhaps someone who knows the intricacies of Ecto guts and the TDS protocol can use what I've sleuthed out and make this change (assuming my suggested change is on the right track). |
@moogle19 @mjaric Hi guys. Wondering if you could weigh in on the above as this is a major pain point for us right now. We'd be happy to create a PR to address this issue but need some guidance about the right way to solve it. Could you weigh in on the above and let us know if we're on the right track here? |
cc: @ewitchin 👆 |
See elixir-ecto#124 for more details. This fix is a complete hack that gets the job done for date columns but fails for the same reason on binary columns. Thankfully for us, we don't have any binary columns, so this works until a correct fix can be made.
@markquezada or @rschenk could you please create simple repo that can I check? Thing is that ecto is layer above tds, and there are a lot of points where this could go wrong. Maybe fix could be done in Ecto.Tds.Adapter instead of in Tds driver. |
Hi @mjaric sorry for the delay, I've made a repo here: https://github.com/rschenk/ecto_tds_null_dates |
@mjaric just making sure you saw the above ☝️ |
Tnx. I will check it |
Hi folks, any news on this issue? I bonked into it today. I was able to work around it by changing the column type to string, but i suspect i'm losing some storage there. any other workarounds that make more sense? |
@mlooney I've not heard any news myself. I made a repo illustrating the problem with a failing test, linked above, but have not heard about any progress towards fixing it |
Repo.Update fails when the changeset includes a nil date value with an intent to update a date field to set to null. The error message states:
The changeset looks like
The text was updated successfully, but these errors were encountered: