Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSupport summation into 128-bit integer #1692
Comments
This comment has been minimized.
|
Thanks, but there's no SQL type which maps to a 128 bit integer. Numeric is neither an integer type, nor is it limited to 128 bits. |
sgrif
closed this
May 13, 2018
This comment has been minimized.
coder543
commented
May 13, 2018
•
|
So there's no way we can make it type-safe to sum a column that we know is made of 64-bit integers into a 128-bit integer value? At compile time we have all the information needed, don't we? |
This comment has been minimized.
coder543
commented
May 13, 2018
•
|
The I would rather have the option to sum a 64-bit column into a 64-bit integer with possible overflow than to deal with pulling in a |
This comment has been minimized.
|
Possibly, but that would require:
It's definitely possible for you to do this in a third party crate though, by introducing a new SQL type, and defining a new |
coder543 commentedMay 12, 2018
•
edited
If I have a table that has a 64-bit
valuecolumn in it, it would be nice to be able tosum()it into a 128-bit integer, rather than having to pull in someBigDecimalcrate, now that 128-bit integers are in stable Rust. For 32-bit integers, they currentlysum()into a 64-bit integer, so I think this is a nice symmetry to add. Personally, I would like to have the option tosum()into a same-sized type like the Rust stdlib does, but it is also nice to ensure there will not be an overflow by summing into a larger type.Right now, the following code:
yields this error: