-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
see #919 (comment)
- Loading branch information
Showing
1 changed file
with
0 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2fd26b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
2fd26b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@annadostoevskaya supporting
u64
here is a footgun because we can't encode or decode the full range of values. The fact that SQLite acceptsUNSIGNED BIG INT
as a type is just sort of a lie.2fd26b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but I don't understand.
What exactly is the problem?
Can't we do this:
2^64-1 as 0b1111...1 and convert it to 0xff...ff, and then write to database.
It's really have problem?
2fd26b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The database would see that value as -1 so trying to do arithmetic or comparison with the value in SQL would be problematic. Addition and subtraction might be fine as that's how two's complement works, but everything else would be wrong: multiplication, division, sorting, conversion to other numeric types, etc.
2fd26b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And we can't write the database in such a way that it can interpret the value correctly?
2fd26b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SQLite handles all integers as signed values, so no. The smaller types work because they can be cast to a wider type, but SQLite doesn't support anything wider than 64 bit.
Sure we could shove it in a
BLOB
column but that has the same problems and more.2fd26b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. So this is a SQLite implementation issue. Thank you for the clarification.
2fd26b5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, today i remember about this dialog and I realized my mistake
i just wanna say thanks, again