Skip to content
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

u64 not being casted to UBigInt and being casted to BigInt instead #256

Closed
riverreal opened this issue Jan 18, 2024 · 1 comment
Closed

Comments

@riverreal
Copy link

It turns out u64 is being interpreted as BigInt instead of UBigInt.
If you have a large enough u64 value that exceeds BigInt's range it will cause an error.

The following code:

println!("u64_num: {}", u64_num);
println!("u64_num.to_sql(): {:?}", u64_num.to_sql()?);

prints:

u64_num: 17870283321416203196
u64_num.to_sql(): Owned(BigInt(-576460752293348420))

And if you use it to execute something it will cause:

Error: Conversion Error: Type INT64 with value -576460752293348420 can't be cast because the value is out of range for the destination type UINT64
@riverreal
Copy link
Author

Nvm I was using a really old version of the crate.
Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant