Re: [sqlite] Atoi64 bug(s)

2018-01-25 Thread Cezary H. Noweta
Hello, On 2018-01-26 00:54, petern wrote: I am interested to see your solution where NUMERIC CAST has sensible interpretation between MAX_INT and MAX_REAL. The patch focuses on problems with TEXT=>NUM conversions. The sole exception is INT=>FLOAT, when a value could lose an information.

Re: [sqlite] Atoi64 bug(s)

2018-01-25 Thread petern
Cezary. Your short form fix for the spurious NUMERIC CAST due to trailing space was definitely received in your original posting. I am interested to see your solution where NUMERIC CAST has sensible interpretation between MAX_INT and MAX_REAL. IMO, simple INT saturation is not convenient for

Re: [sqlite] Atoi64 bug(s)

2018-01-25 Thread Cezary H. Noweta
Hello, On 2018-01-25 22:58, petern wrote: Thank you for expanding on your detailed observations. If you can, please post the long patch at your customary patch site http://sqlite.chncc.eu/ I was convinced that I had publicized my patch already. For the people who are interested in the patch,

Re: [sqlite] Atoi64 bug(s)

2018-01-25 Thread Cezary H. Noweta
Hello, On 2018-01-25 22:08, Stephen Chrzanowski wrote: According to https://www.sqlite.org/datatype3.html *2. Storage Classes and DatatypesEach value stored in an SQLite database (or manipulated by the database engine) has one of the following storage classes:NULL. The value is a NULL

Re: [sqlite] Atoi64 bug(s)

2018-01-25 Thread petern
Thank you for expanding on your detailed observations. If you can, please post the long patch at your customary patch site http://sqlite.chncc.eu/ Also, in the link text, please make note of the exact SQLite version the patch is for. The lesson I draw is that unconditionally correct queries must

Re: [sqlite] Atoi64 bug(s)

2018-01-25 Thread Stephen Chrzanowski
According to https://www.sqlite.org/datatype3.html *2. Storage Classes and DatatypesEach value stored in an SQLite database (or manipulated by the database engine) has one of the following storage classes:NULL. The value is a NULL value.INTEGER. The value is a signed integer,

Re: [sqlite] Atoi64 bug(s)

2018-01-25 Thread Cezary H. Noweta
Hello, On 2018-01-25 19:54, petern wrote: CREATE TABLE IF NOT EXISTS a (a INTEGER); INTEGER == NUMERIC in case of column declarations. -- Note however, the constant table expression works fine... SELECT CAST(column1 AS INTEGER) FROM (VALUES ('901'),('901

Re: [sqlite] Atoi64 bug(s)

2018-01-25 Thread petern
Confirmed. sqlite> .version SQLite 3.22.0 2018-01-22 18:45:57 0c55d179733b46d8d0ba4d88e01a25e10677046ee3da1d5b1581e86726f2alt1 zlib version 1.2.8 gcc-4.8.4 --FYI some background: -- --min 64b signed int: SELECT CAST(0x8000 AS INTEGER); --

Re: [sqlite] Atoi64 bug(s)

2018-01-25 Thread Stephen Chrzanowski
RE the first question, the largest positive 64-bit number is 18446744073709551615, or, 18,446,744,073,709,551,615. Your number is overloading that value. 12,345,678,901,234,567,890,123 vs 18,446,744,073,709,551,615 AFAIK, SQLite uses max of 64-bit integer math, not 128. On Thu, Jan 25, 2018 at

[sqlite] Atoi64 bug(s)

2018-01-25 Thread Cezary H. Noweta
Hello, About year age I reported some strange behavior: 1. https://www.sqlite.org/lang_expr.html#castexpr: INTEGER: ``When casting a TEXT value to INTEGER, the longest possible prefix of the value that can be interpreted as an integer number is extracted from the TEXT value and the