-
Notifications
You must be signed in to change notification settings - Fork 551
uint64 equality and eager loading bug #399
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
Comments
We are facing the same issue. I'm not sure what the exact reason for the cast to int64 is, I suspect it is somehow related with golang/go#18417 and general driver support (e.g.: go-sql-driver/mysql#838) for uint64? (correct me if I'm wrong :) ) I mitigated the issue by modifying This is the change: styque@4c7a446 |
@mickeyreiss The problem starts out here: It's not acceptable for
Now, there should be no underflow/overflow occurring here because we are just modifying the representation but the bits should stay the same: I actually think that @fridolin-koch's solution is correct. There's just a missing case because if it is a uint64 we do need to change it into an int64 to be compatible with whatever is coming back from the |
We are facing a strange issue where eager loads on nullable uint64 fields, such that eager loads of related models completely fail:
We have narrowed this down to a possible bug in
null/int64.go
:We also dug into
reflect.go
and found some potentially suspect code. Apparently unsigned numbers are casted to signed numbers before==
in upgradeNumericTypes. Maybe this is correct, but we didn't see an explicit comment around comparing unsigned and signed values.Is it correct to cast the
uint64
to anint64
here?We use mysql
bigint unsigned
for our primary keys and foreign relations, and we are seeing this in a number of situations where we are eager loading a model with a bigint unsigned foreign key to the model being queried.We tried the obvious thing..hacking the line above to uint64, but then other errors crop up. We presume that the bug is consistent in a number of places in the generated models.
P.S. Does the Value bug above lead to a underflow issues for negative numbers?
cc/ @jthreatt4
The text was updated successfully, but these errors were encountered: