On 25/05/2009 4:28 PM, Kelly Jones wrote: > I tried inserting 2^63-1 and the two integers after it into an SQLite3 > db, but this happened: > > SQLite version 3.6.11 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> CREATE TABLE test (test INT); > sqlite> INSERT INTO test VALUES (9223372036854775807); > sqlite> INSERT INTO test VALUES (9223372036854775808); > sqlite> INSERT INTO test VALUES (9223372036854775809); > sqlite> .mode line > sqlite> SELECT * FROM test; > test = 9223372036854775807 > test = 9.22337203685478e+18 > test = 9.22337203685478e+18 > > sqlite> SELECT * FROM test WHERE test = '9223372036854775808'; > test = 9.22337203685478e+18 > test = 9.22337203685478e+18 > > Why the sudden switch to scientific notation and loss of precision?
See answer to next question. > Are 64-bit integers signed (ie -2^63 to 2^63-1)? SQLite's integers are 64-bit signed two's-complement. Don't bet the ranch on -2^63. > Can I "unsign" them? No. > Since sqlite3 uses 64-bit ints for rowid, I figured they'd be unsigned. Since using rowids at the rate of 1 million per second would bump into 2^63 after about 292,000 years, and since SQLite has only one integer type, to figure that it'd be signed would be a better betting proposition. > Workarounds? BLOBs, maybe, depending what you want 64-bit unsigned integers for. What's the use case? Cheers, John _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users