Question

I'm using SQLite Manager (addon in Mozilla Firefox) I'm trying to insert a 17 digit number (same problem for bigger numbers) to a table. For example:

INSERT INTO Table (ColA)
VALUES(2305843009213693951)

If ColA has a type of INTEGER', 'REAL', 'DOUBLE', 'FLOAT' or 'NUMERIC then it's not working. I get instead of 2305843009213693951 -> 2305843009213694000 If ColA has a type of TEXT orVARCHAR then it's working just fine.

But I want to work with some integer type without parsing between string and int type.

Does anyone know that problem and can tell me what's wrong? Also, is there another sqlite managment tool that does supoort it? I prefer to continue working with the current tool (it very easy and nice - this addon).

Was it helpful?

Solution

The data is actually stored correctly. I verified this using the sqlite3 command line tool.

The problem is merely the presentation in SQLite Manager. The add-on is written in Javascript, which lacks support for int64/big integer types. So when the data is queried, the big integer will be converted into a double precision float in Javascript before displaying it, and that double cannot represent the integer correctly.

You may try this yourself:

  • Open the Web Console on any page
  • Enter: 2305843009213693951
  • Result: 2305843009213694000

You may ask the author of the add-on to work-around this issue.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top