On Thu, 1 Nov 2018 01:18:26 +0100
szmate1618 <szmate1...@gmail.com> wrote:

> But there seems to be an unintended
> workaround
> 
> DROP TABLE IF EXISTS TestReal;CREATE TABLE TestReal(A REAL
> UNIQUE);INSERT INTO TestReal values (9223372036854775807);INSERT INTO
> TestReal values (9223372036854775807 - 1);INSERT INTO TestReal values
> (9223372036854775807 - 2);INSERT INTO TestReal values
> (9223372036854775807 - 3);
> 
> runs without any problems. 

On Wed, 31 Oct 2018 23:05:19 -0300
Bernardo Sulzbach <berna...@bernardosulzbach.com> wrote:

> So if you are inserting integers
> into a real column, you are going to store integers. However, when you
> select from it they are presented as reals and mix up (looking as if
> there were duplicates [...]

I don't think that explanation holds water.  

sqlite> 
DROP TABLE IF EXISTS TestReal;CREATE TABLE TestReal(A REAL
UNIQUE);INSERT INTO TestReal values (9223372036854775807);INSERT INTO
TestReal values (9223372036854775807 - 1);INSERT INTO TestReal values
(9223372036854775807 - 2);INSERT INTO TestReal values
(9223372036854775807 - 3);sqlite>    ...>    ...>    ...>    ...> 

sqlite> select cast(A as integer) from TestReal;
9223372036854775807
9223372036854775807
9223372036854775807
9223372036854775807

sqlite> select hex(A) from TestReal;
392E3232333337323033363835343738652B3138
392E3232333337323033363835343738652B3138
392E3232333337323033363835343738652B3138
392E3232333337323033363835343738652B3138

sqlite> select count(*), hex(A) from TestReal group by hex(A);
4|392E3232333337323033363835343738652B3138

sqlite> .schema TestReal
CREATE TABLE TestReal(A REAL
UNIQUE);
sqlite> 

Curiouser and curiouser.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to