-
Notifications
You must be signed in to change notification settings - Fork 547
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
Unable to convert type: types.Decimal #803
Comments
So what's happened is there's this proposal in Go: golang/go#30870 What happens is the driver? (lib/pq or pkg/sql/driver) overrides the Something appears to be wrong with this implementation, though I'm not really sure what. Though almost certainly it does not do the things that we want it to do (our decimal implementation for example forbids NaN as a value) so we'll eventually need to override this as well. I'll file something on the decimal library and we'll see what happens. |
Much appreciated ;-) |
I've analyzed the root cause of the breakage: golang/go#30870 (comment) Feedback appreciated. |
I faced same issue. Is there workaround?
|
One workaround I am using is to replace the types.Decimal in code generation:
|
running into a similar issue where the built-in types.Decimal always fails with "NOT NULL constraint", changing no code (except for the type change) and using @zhangi solution solves it. |
@zhangi Your solution was LIFE SAVING ! i struggled 7 hours while trying to make this work with the default package and didn't think we could ask sql boiler to change default type !!! THX SO MUCH |
I'm using
I had to upgrade to |
we still have the issue here, with SQLBoiler v4.16.2 |
What version of SQLBoiler are you using (
sqlboiler --version
)?v4 (4.2.0)
What is your database and version (eg. Postgresql 10)
MySQL - 8.0.19
If this happened at runtime what code produced the issue? (if not applicable leave blank)
Inserting a record, table has a field using type:
decimal(5,4)
What is the output of the command above with the
-d
flag added to it?unable to insert into (table_name): cannot convert type: types.Decimal
Please provide a relevant database schema so we can replicate your issue (Provided you are comfortable sharing this)
Further information. What did you do, what did you expect?
I thought this issue would be fixed by now.
I saw something about hardcoding the ericlagergren decimal package, but I want to make sure I'm not missing something...
The text was updated successfully, but these errors were encountered: