Re: [sqlite] Using SQLite internal recognizers eg: SQLITE_PRIVATE int sqlite3AtoF()

2018-01-23 Thread petern
I am drawing from parallel functionality in the existing API.Roughly, the API sqlite3_buffer_numeric_type() would simply be the buffer input version of the existing API sqlite3_value_numeric_type(). But instead of operating on a sqlite3_value parameter, it would read from a pzBuffer parameter

Re: [sqlite] Using SQLite internal recognizers eg: SQLITE_PRIVATE int sqlite3AtoF()

2018-01-23 Thread Richard Hipp
On 1/23/18, petern wrote: > Any chance of publishing a modest but hardened "int > sqlite3_numeric_buffer_type(const char*pBuffer,int length,int encoding)" > API that extensions can use? I'm not sure what "sqlite3_numeric_buffer_type()" is suppose to do? -- D.

Re: [sqlite] Using SQLite internal recognizers eg: SQLITE_PRIVATE int sqlite3AtoF()

2018-01-23 Thread petern
Any chance of publishing a modest but hardened "int sqlite3_numeric_buffer_type(const char*pBuffer,int length,int encoding)" API that extensions can use? On Tue, Jan 23, 2018 at 4:43 PM, Richard Hipp wrote: > On 1/23/18, petern wrote: > > What is

Re: [sqlite] Using SQLite internal recognizers eg: SQLITE_PRIVATE int sqlite3AtoF()

2018-01-23 Thread Richard Hipp
On 1/23/18, petern wrote: > What is the fastest forward compatible way to gain use of the internal > buffer value recognizers such as "SQLITE_PRIVATE int sqlite3AtoF()" in > external C programs? > There is no forwards-compatible way to do that. We reserve the right

[sqlite] Using SQLite internal recognizers eg: SQLITE_PRIVATE int sqlite3AtoF()

2018-01-23 Thread petern
What is the fastest forward compatible way to gain use of the internal buffer value recognizers such as "SQLITE_PRIVATE int sqlite3AtoF()" in external C programs? The goal is to efficiently compute exactly how SQLite would taxonomically classify {numeric,float,integer,...} a buffer string value

Re: [sqlite] sqlite 3.21.0 bug? SELECT CAST ('9223372036854775807 ' AS NUMERIC);

2018-01-23 Thread Tony Papadimitriou
If it helps, I can reproduce with the mentioned binary on Win7 but I cannot with my own compiled version (using MSVC). -Original Message- From: Ralf Junker On 23.01.2018 15:31, Richard Hipp wrote: I'm still unable to reproduce this problem. sqlite3.exe from this ZIP:

Re: [sqlite] .DUMP displays floats differently from SELECT

2018-01-23 Thread Jens Alfke
> On Jan 22, 2018, at 10:12 PM, Cezary H. Noweta wrote: > > I suppose that 20 digits is taken from the fact: 64ln(2)/ln(10)=19.2..., > however, for 64bit mantissa (long double) it is not enough (to be represented > exactly), for 53bit mantissa it is too many. Besides

Re: [sqlite] Tcl binding: Quirk with Tcl variable reference in eval method

2018-01-23 Thread Richard Hipp
On 1/23/18, Rolf Ade wrote: > > While being able to use Tcl variable references inside db eval SQL > statements (as in > > set name "foo'bar" > db eval {SELECT * FROM sometable WHERE somecolumn = $name} > > ) this does work only for "simple" Tcl variable references. That is

Re: [sqlite] sqlite 3.21.0 bug? SELECT CAST ('9223372036854775807 ' AS NUMERIC);

2018-01-23 Thread Richard Hipp
On 1/23/18, Petr Kubat wrote: > Still present in 3.22.0: > > ! e_expr-32.2.5 expected: [integer 9223372036854775807] > ! e_expr-32.2.5 got: [real 9.22337203685478e+18] > > Is there any more information I can provide to get this looked at? Ralf provided the information I

Re: [sqlite] unexpected row value error

2018-01-23 Thread Dan Kennedy
On 01/23/2018 07:55 PM, Mark Brand wrote: Hi, The 6th SELECT example below throws an error. This seems unexpected, especially given the contrast with example 3, which differs only in lacking a seemingly unrelated JOIN. Am I overlooking something? Removing the PRIMARY KEY from table x also

[sqlite] Tcl binding: Quirk with Tcl variable reference in eval method

2018-01-23 Thread Rolf Ade
While being able to use Tcl variable references inside db eval SQL statements (as in set name "foo'bar" db eval {SELECT * FROM sometable WHERE somecolumn = $name} ) this does work only for "simple" Tcl variable references. This script shows this: package require sqlite3 sqlite3 db ":memory:"

Re: [sqlite] Bug in unique index

2018-01-23 Thread petern
The second UNIQUE(v2,v1) constraint is redundant and equivalent to UNIQUE(v1,v2) Also consider that {(1,2),(2,1)} has no duplicates: sqlite> WITH test(v1,v2) AS (VALUES (1,2),(2,1)) SELECT DISTINCT * FROM test; v1,v2 1,2 2,1 Peter On Tue, Jan 23, 2018 at 8:35 AM, Domingo Alvarez Duarte

Re: [sqlite] [EXTERNAL] Bug in unique index

2018-01-23 Thread Hick Gunter
Not a bug. Unique(v1,v2) implies unique(v2,v1) which makes the second definition superflous (1,2) is distinct from (2,1) (because tuples are ordered), no violation of unique. If you want to exclude equivalent sets, your check needs to be v1 < v2. -Ursprüngliche Nachricht- Von:

Re: [sqlite] Bug in unique index

2018-01-23 Thread Simon Slavin
> On 23 Jan 2018, at 4:35pm, Domingo Alvarez Duarte wrote: > > create table test( > id integer primary key, > v1 integer not null, > v2 integer not null constraint not_equal check(v1 != v2), > unique(v1, v2), > unique(v2, v1) > ); > > insert into test

Re: [sqlite] sqlite 3.21.0 bug? SELECT CAST ('9223372036854775807 ' AS NUMERIC);

2018-01-23 Thread Jim Callahan
What locale? The locale setting may influence character to numeric conversions at the C language library level. sqlite> SELECT CAST ('9223372036854775807 ' AS NUMERIC); > 9.22337203685478e+18 > sqlite> SELECT CAST ('9223372036854775807' AS NUMERIC); > 9223372036854775807 > Notice the trailing

[sqlite] Bug in unique index

2018-01-23 Thread Domingo Alvarez Duarte
Hello ! Maybe I found a bug in sqlite3 unique index, see example bellow: bug-unique.sql drop table if exists test; create table test(     id integer primary key,     v1 integer not null,     v2 integer not null constraint not_equal check(v1 != v2),     unique(v1, v2),     unique(v2, v1) );

Re: [sqlite] [EXTERNAL] Re: sqlite 3.21.0 bug? SELECT CAST ('9223372036854775807 ' AS NUMERIC);

2018-01-23 Thread Hick Gunter
I think I may have found the problem: The ToNumeric opcode calls sqlite3VdbeMemNumerify() which has (in 3.7.14.1) the following code: if( 0==sqlite3Atoi64(pMem->z, >u.i, pMem->n, pMem->enc) ){ MemSetTypeFlag(pMem, MEM_Int); }else{ pMem->r = sqlite3VdbeRealValue(pMem);

Re: [sqlite] unexpected row value error

2018-01-23 Thread petern
Confirmed that way too. CREATE TABLE x ( a, b, PRIMARY KEY (a, b) ); CREATE TABLE y ( a ); INSERT INTO x VALUES (1, 1), (1, 2); INSERT INTO y VALUES (1); SELECT * FROM x JOIN y ON y.a = x.a WHERE (x.a, x.b) IN (VALUES (1,2)); --Error: sub-select returns 2 columns - expected 1 SELECT * FROM x

Re: [sqlite] unexpected row value error

2018-01-23 Thread petern
Confirmed. SQLite 3.22.0 2018-01-12 23:38:10 dec3ea4e4e6c4b1761ddc883a29eaa50dcd663ce6199667cc0ff82f7849d4f2a CREATE TABLE x ( a, b, PRIMARY KEY (a, b) ); CREATE TABLE y ( a ); CREATE TABLE z ( a, b ); INSERT INTO x VALUES (1, 1), (1, 2); INSERT INTO y VALUES (1); INSERT INTO z VALUES (1, 1),

Re: [sqlite] sqlite 3.21.0 bug? SELECT CAST ('9223372036854775807 ' AS NUMERIC);

2018-01-23 Thread Ralf Junker
On 23.01.2018 15:31, Richard Hipp wrote: I'm still unable to reproduce this problem. sqlite3.exe from this ZIP: https://www.sqlite.org/2018/sqlite-tools-win32-x86-322.zip Running on Windows 7: SQLite version 3.22.0 2018-01-22 18:45:57 Enter ".help" for usage hints. Connected to a

Re: [sqlite] sqlite 3.21.0 bug? SELECT CAST ('9223372036854775807 ' AS NUMERIC);

2018-01-23 Thread Joseph R. Justice
On Jan 23, 2018 9:32 AM, "Richard Hipp" wrote: I'm still unable to reproduce this problem. I've tried on every 32-bit platform I have at hand: * Ubuntu with -m32 * Android * MacOS 10.6.8 with -m32 * MinGW (32-bit) on Win7 * MSVC (32-bit) on Win10 They all give

Re: [sqlite] unexpected row value error

2018-01-23 Thread curmudgeon
Probably won't help but the final one works with SELECT in double brackets SELECT * FROM x JOIN y ON y.a = x.a WHERE (x.a, x.b) IN ( ( SELECT a, b FROM z ) ); . -- Sent from: http://sqlite.1065341.n5.nabble.com/ ___ sqlite-users mailing list

Re: [sqlite] sqlite 3.21.0 bug? SELECT CAST ('9223372036854775807 ' AS NUMERIC);

2018-01-23 Thread Richard Hipp
I'm still unable to reproduce this problem. I've tried on every 32-bit platform I have at hand: * Ubuntu with -m32 * Android * MacOS 10.6.8 with -m32 * MinGW (32-bit) on Win7 * MSVC (32-bit) on Win10 They all give the correct answer. I'm sorry you are having problems. But it

[sqlite] unexpected row value error

2018-01-23 Thread Mark Brand
Hi, The 6th SELECT example below throws an error. This seems unexpected, especially given the contrast with example 3, which differs only in lacking a seemingly unrelated JOIN.  Am I overlooking something? Removing the PRIMARY KEY from table x also avoids the error somehow. Seen on version

Re: [sqlite] sqlite 3.21.0 bug? SELECT CAST ('9223372036854775807 ' AS NUMERIC);

2018-01-23 Thread Petr Kubat
Still present in 3.22.0: ! e_expr-32.2.5 expected: [integer 9223372036854775807] ! e_expr-32.2.5 got: [real 9.22337203685478e+18] ! e_expr-32.2.6 expected: [integer 9223372036854775807] ! e_expr-32.2.6 got: [real 9.22337203685478e+18] ! e_expr-32.2.8 expected: [integer

Re: [sqlite] [EXTERNAL] Re: Can this be done with SQLite

2018-01-23 Thread Hick Gunter
You need to use a temporary table because by the time you select the key 1 value it has already been overwritten. BEGIN; CREATE TEMP TABLE new_speed AS SELECT (key +4) % 5 AS key, speed FROM playYouTubeVideo; UPDATE playYouTubeVideo SET speed = SELECT speed FROM new_speed WHERE new_speed.key =