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 upINTEGER PRIMARY KEY in SQLite #852
Comments
This comment has been minimized.
|
Is this really an issue ? I just tried and I was able to insert 2^256 in an integer field. SQLite does not really care about types. It would be confusing for users to deserialize what they think is an integer to an i64 though as I'm sure nobody knows about this bug. If you need to retrieve a I Bigint from SQLite, you can use the table macro and say it's a bigint |
This comment has been minimized.
lnicola
commented
Jul 17, 2017
•
|
It's not an issue for
Yeah, that works. |
This comment has been minimized.
|
I'm a bit torn on what to do here. It's really unfortunate that SQLite requires the type name to be exactly |
lnicola commentedApr 8, 2017
•
edited
Diesel deduces the a column's type as
BigIntif it's declared asBIGINTin the database. This is generally fine in SQLite becauseINTEGERandBIGINTare synonyms, butINTEGER PRIMARY KEYis treated differently and is always 64-bit according to https://sqlite.org/autoinc.html. Moreso,BIGINT PRIMARY KEY AUTOINCREMENTis not accepted.It might be a good idea to detect these columns and use
BigIntfor them. Note that the SQLite documentation says thatINTEGER PRIMARY KEYis special only for tables that aren't declared withWITHOUT ROWID, butBIGINT PRIMARY KEYis still not allowed even when using that.