[sqlite] union, order by, and a phantom record

2016-02-08 Thread R Smith
Definitely a bug: I distilled the OP's code into an easy repeatable test case - --- create table t(id integer primary key autoincrement, a, b, c); insert into t values (3,1 ,'name','Imogen') ,(5,1 ,'gender' ,'female') ,(6,1 ,'son' ,'

[sqlite] union, order by, and a phantom record

2016-02-08 Thread Richard Hipp
On 2/8/16, Richard Hipp wrote: > On 2/8/16, Poor Yorick wrote: >> The following query produces a third phantom record on my system: > > Running "PRAGMA automatic_index=OFF;" might alleviate the symptoms > your are experiencing, until we can get a proper fix published. > The bug appears to be qui

[sqlite] union, order by, and a phantom record

2016-02-08 Thread Poor Yorick
On 2016-02-08 19:15, Richard Hipp wrote: > On 2/8/16, Richard Hipp wrote: >> On 2/8/16, Poor Yorick wrote: >>> The following query produces a third phantom record on my system: >> >> Running "PRAGMA automatic_index=OFF;" might alleviate the symptoms >> your are experiencing, until we can get a p

[sqlite] Can't create LEFT or RIGHT functions with sqlite3_create_function()

2016-02-08 Thread Eric Hill
That's fair. Thanks for looking into it. I can create JLEFT and JRIGHT or something, or just direct people to SUBSTR. There are reasonable workarounds. Thanks, Eric -Original Message- From: sqlite-users-bounces at mailinglists.sqlite.org [mailto:sqlite-users-boun...@mailinglists.sql

[sqlite] Can't create LEFT or RIGHT functions with sqlite3_create_function()

2016-02-08 Thread Eric Hill
Hey, It appears that LEFT and RIGHT are treated as reserved words by SQLite, so my attempts to use sqlite3_create_function() to create my own LEFT and RIGHT SQL functions have been unsuccessful (I'm using 3.8.11.1). Several databases (SQL Server, MySQL) define their own LEFT and RIGHT function

[sqlite] union, order by, and a phantom record

2016-02-08 Thread Richard Hipp
On 2/8/16, Poor Yorick wrote: > The following query produces a third phantom record on my system: Running "PRAGMA automatic_index=OFF;" might alleviate the symptoms your are experiencing, until we can get a proper fix published. > > > = start script = > package require sqlite3 > > sqlite

[sqlite] How to enter Unicode character?

2016-02-08 Thread Dominique Devienne
On Mon, Feb 8, 2016 at 5:43 PM, Dominique Devienne wrote: > sqlite> select c?, length(c?), length(cast(c? as blob)), unicode(c?) from > t?; > c?|length(c?)|length(cast(c? as blob))|unicode(c?) > ??|1|2|252 > ?|1|1|129 > > sqlite> .schema >> > CREATE TABLE t? (c?); >> > What's surprising is that t

[sqlite] How to enter Unicode character?

2016-02-08 Thread Dominique Devienne
On Mon, Feb 8, 2016 at 5:33 PM, Dominique Devienne wrote: > On Mon, Feb 8, 2016 at 4:46 PM, Igor Korot wrote: > >> On Mon, Feb 8, 2016 at 10:36 AM, Dominique Devienne >> wrote: >> What I mean is the following: >> >> sqlite> CREATE TABLE abc(); >> >> In that line '' should be the German characte

[sqlite] How to enter Unicode character?

2016-02-08 Thread Dominique Devienne
On Mon, Feb 8, 2016 at 4:46 PM, Igor Korot wrote: > On Mon, Feb 8, 2016 at 10:36 AM, Dominique Devienne > wrote: > What I mean is the following: > > sqlite> CREATE TABLE abc(); > > In that line '' should be the German character which look like the > Greek letter "beta". > ... In the good old DO

[sqlite] How to enter Unicode character?

2016-02-08 Thread Graham Holden
In case it helps... In a command-prompt, ALT 156 (hold ALT while pressing 156 on the NUMERIC keypad) uses the current code-page (British pound sign - ? - for me). ?Using ALT 0163 (i.e. preceding the character-code with a zero) uses Unicode (also a ?). I don't have an sqlite3 shell to hand to t

[sqlite] union, order by, and a phantom record

2016-02-08 Thread Richard Hipp
On 2/8/16, R Smith wrote: > Definitely a bug: I distilled the OP's code into an easy repeatable test > case - https://www.sqlite.org/src/tktview/d06a25c84454a372be4e4c970c3c4d4363197219 -- D. Richard Hipp drh at sqlite.org

[sqlite] Andl: choices for generic types: bool, binary, number/decimal, date/datetime, text/varchar

2016-02-08 Thread Darren Duncan
David, unless you're wanting to use SQLite's built-in datetime operators, then just encode yours somehow and put them in another field type, and decode them on retrieval into your own datetime types. Depending what you encode them as, pick the appropriate built-in type. -- Darren Duncan On 2

[sqlite] How to enter Unicode character?

2016-02-08 Thread Dominique Devienne
On Mon, Feb 8, 2016 at 4:28 PM, Dominique Devienne wrote: > On Mon, Feb 8, 2016 at 4:17 PM, Igor Korot wrote: > >> Now my question is: is it possible to enter a Unicode character >> > > Yes. Just use the char() built-in function. --DD > Oh, by "SQLite table contains" you meant the "table name".

[sqlite] How to enter Unicode character?

2016-02-08 Thread Stephan Beal
On Mon, Feb 8, 2016 at 4:27 PM, Igor Korot wrote: > At the moment I'm using Win 8.1. > And the sqlite3.exe shell tool. > > So if I go with option 2, I will copy the character and the paste it > into the command. > Something like : > > sqlite3> CREATE TABLE abc(); > > right? > That's what Unix wo

[sqlite] How to enter Unicode character?

2016-02-08 Thread Dominique Devienne
On Mon, Feb 8, 2016 at 4:17 PM, Igor Korot wrote: > Now my question is: is it possible to enter a Unicode character > Yes. Just use the char() built-in function. --DD

[sqlite] How to enter Unicode character?

2016-02-08 Thread Stephan Beal
On Mon, Feb 8, 2016 at 4:17 PM, Igor Korot wrote: > Hi, ALL, > I live in US and therefore have an English-based laptop with an > English-based keyboard. > > I am also a programmer and would like to test what happen if I have a > SQLite table > which contains a Unicode character. > It depends en

[sqlite] Can't create LEFT or RIGHT functions with sqlite3_create_function()

2016-02-08 Thread Richard Hipp
On 2/8/16, Eric Hill wrote: > Hey, > > It appears that LEFT and RIGHT are treated as reserved words by SQLite, so > my attempts to use sqlite3_create_function() to create my own LEFT and RIGHT > SQL functions have been unsuccessful (I'm using 3.8.11.1). Several > databases (SQL Server, MySQL) def

[sqlite] EBCDIC tester needed

2016-02-08 Thread John McKown
On Mon, Feb 8, 2016 at 1:45 PM, Richard Hipp wrote: > The latest SQLite check-ins contain changes to the SQL language > tokenizer. These changes have been tested on Unicode systems, but we > do not have access to any systems running EBCDIC in order to test > there. If you are deploying SQLite o

[sqlite] EBCDIC tester needed

2016-02-08 Thread Richard Hipp
The latest SQLite check-ins contain changes to the SQL language tokenizer. These changes have been tested on Unicode systems, but we do not have access to any systems running EBCDIC in order to test there. If you are deploying SQLite on a computer that uses the EBCDIC character set, we would appr

[sqlite] union, order by, and a phantom record

2016-02-08 Thread Poor Yorick
The following query produces a third phantom record on my system: = start script = package require sqlite3 sqlite3 [namespace current]::db :memory: db eval { create table if not exists eav ( id integer primary key autoincrement ,entity numeric ,attribute

[sqlite] What's the reason for alias names not being visible in subqueries?

2016-02-08 Thread Paul
Not really, then I would have to select child table with which to JOIN on condition, based on the value of parent table. CREATE TABLE parent( id INTEGER PRIMARY KEY, child_type INTEGER, CHECK(child_type IN (1, 2)) ); CREATE TABLE child_1( id INTEGER PRIMARY KEY, my_value INTEGER, ..

[sqlite] What's the reason for alias names not being visible in subqueries?

2016-02-08 Thread Paul
I see, thank you for pointing out. I wanted to use it on table with conditional relations with 3 different child tables. Though I could use a trick and fit data selection into one query, efficiently. Alas I am forced to stick to 2 queries. Thank you! 8 February 2016, 12:08:26, by "Clemens Ladis

[sqlite] What's the reason for alias names not being visible in subqueries?

2016-02-08 Thread Clemens Ladisch
Paul wrote: > CREATE TABLE parent( > CREATE TABLE child_1( > CREATE TABLE child_2( > CREATE TABLE parent_child_1_link( > CREATE TABLE parent_child_2_link( > > now, depending on the child_type in the parent I want to select ... Show your query. Or at least example data and the desired result. Re

[sqlite] How to enter Unicode character?

2016-02-08 Thread Igor Korot
Dominique, On Mon, Feb 8, 2016 at 11:43 AM, Dominique Devienne wrote: > On Mon, Feb 8, 2016 at 5:33 PM, Dominique Devienne > wrote: > >> On Mon, Feb 8, 2016 at 4:46 PM, Igor Korot wrote: >> >>> On Mon, Feb 8, 2016 at 10:36 AM, Dominique Devienne >>> wrote: >>> What I mean is the following: >>

[sqlite] What's the reason for alias names not being visible in subqueries?

2016-02-08 Thread Clemens Ladisch
Paul wrote: > I am curious what is a particular reason that aliased columns in a query not > visible to sub-queries? Because the SQL standard says so. > Of course it is possible to duplicate expression in sub-query ... > But this would not be as efficient as to access result of already evaluated

[sqlite] What's the reason for alias names not being visible in subqueries?

2016-02-08 Thread Paul
Hello! I am curious what is a particular reason that aliased columns in a query not visible to sub-queries? CREATE TABLE foo( id INTEGER, bar INTEGER ); INSERT INTO foo VALUES(1, 2), (3, 4); SELECT 1 as super_id, (SELECT bar FROM foo WHERE id = super_id); Gives an error: Error: no suc

[sqlite] How to enter Unicode character?

2016-02-08 Thread Igor Korot
Dominique, Stehan, On Mon, Feb 8, 2016 at 10:36 AM, Dominique Devienne wrote: > On Mon, Feb 8, 2016 at 4:28 PM, Dominique Devienne > wrote: > >> On Mon, Feb 8, 2016 at 4:17 PM, Igor Korot wrote: >> >>> Now my question is: is it possible to enter a Unicode character >>> >> >> Yes. Just use the

[sqlite] How to enter Unicode character?

2016-02-08 Thread Igor Korot
Hi, On Mon, Feb 8, 2016 at 10:21 AM, Stephan Beal wrote: > On Mon, Feb 8, 2016 at 4:17 PM, Igor Korot wrote: > >> Hi, ALL, >> I live in US and therefore have an English-based laptop with an >> English-based keyboard. >> >> I am also a programmer and would like to test what happen if I have a >>

[sqlite] How to enter Unicode character?

2016-02-08 Thread Adam Devita
Good day, What OS are you using? Have you read up on this? http://www.fileformat.info/tip/microsoft/enter_unicode.htm Also, Notepad++ is a good text editor for displaying / saving them. (I assume that you are wanting to generate some text files as scripts) regards, Adam DeVita On Mon, Feb 8, 20

[sqlite] How to enter Unicode character?

2016-02-08 Thread Igor Korot
Hi, ALL, I live in US and therefore have an English-based laptop with an English-based keyboard. I am also a programmer and would like to test what happen if I have a SQLite table which contains a Unicode character. Now my question is: is it possible to enter a Unicode character (umlaut symbol,

[sqlite] issue: % in expression with binding paramter.

2016-02-08 Thread László Zoltán Buza
Hello, Today, i ?ve used the following expression, but I?ve got unexpected results: ((@korte % 2) + 1)) I binded ?@korte? to 5 as integer, using sqlite3_bind_parameter_index and sqlite3_bind_int. And I?ve got 6 as result, instead of 2. It does the same with numbered paramters as well. I?v

[sqlite] Use of __builtin_expect in SQLite

2016-02-08 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 07/02/16 22:39, Matthias-Christian Ott wrote: > Amdahl's law is not applicable here and describes a completely > different problem. SQLite does not involve concurrency. Amdahl's law very much applies, and doesn't explicitly only involve concurrency

[sqlite] Use of __builtin_expect in SQLite

2016-02-08 Thread Scott Hess
On Sun, Feb 7, 2016 at 10:39 PM, Matthias-Christian Ott wrote: > On 2016-02-08 04:31, Roger Binns wrote: > > On 07/02/16 00:56, Dominique Pell? wrote: > >> I'm curious about the outcome on SQLite benchmarks. > > > > About a year ago I tried them out on some tight code (non-SQLite) that > > absolu

[sqlite] Use of __builtin_expect in SQLite

2016-02-08 Thread Matthias-Christian Ott
<http://mailinglists.sqlite.org/cgi-bin/mailman/private/sqlite-users/attachments/20160208/2dd38072/attachment.pgp>

[sqlite] What's the reason for alias names not being visible in subqueries?

2016-02-08 Thread Keith Medcalf
select * from parent P, parent_child_1_link L, child_1 C where P.id = L.parent_id and C.id = L.child_id and P.child_type = 1 union select * from parent P, parent_child_2_link L, child_2 C where P.id = L.parent_id and C.id = L.child_id and P.child_type = 2 It is a very straightfo

[sqlite] issue: % in expression with binding paramter.

2016-02-08 Thread Richard Hipp
On 2/8/16, L?szl? Zolt?n Buza wrote: > Hello, > > > > Today, i ?ve used the following expression, but I?ve got unexpected results: > > ((@korte % 2) + 1)) > > > > I binded ?@korte? to 5 as integer, using sqlite3_bind_parameter_index and > sqlite3_bind_int. > > And I?ve got 6 as result, instead of

[sqlite] Use of __builtin_expect in SQLite

2016-02-08 Thread Simon Slavin
On 8 Feb 2016, at 3:31am, Roger Binns wrote: > Taking a step back, the reasons why it had no measureable effect are > simple. The processors are getting better at branch prediction, > better at mitigating mispredicted branches, getting even faster > compared to memory. The compilers are gettin

[sqlite] What's the reason for alias names not being visible in subqueries?

2016-02-08 Thread J Decker
On Mon, Feb 8, 2016 at 3:38 AM, Paul wrote: > I see, thank you for pointing out. > > I wanted to use it on table with conditional relations with 3 different child > tables. > Though I could use a trick and fit data selection into one query, efficiently. > Alas I am forced to stick to 2 queries. >

[sqlite] What's the reason for alias names not being visible in subqueries?

2016-02-08 Thread J Decker
On Mon, Feb 8, 2016 at 12:47 AM, Paul wrote: > Hello! > > I am curious what is a particular reason that aliased columns in a query not > visible to sub-queries? > > CREATE TABLE foo( > id INTEGER, > bar INTEGER > ); > > INSERT INTO foo VALUES(1, 2), (3, 4); > > SELECT 1 as super_id, (SELE

[sqlite] problem on Windows using filenames with non-ASCII characters

2016-02-08 Thread Holger Jakobs
Changing to code page 1200 or 1201 results in an error of the chcp command. These code pages are invalid.? -- Holger Jakobs M?lheimer Str. 133, 51469 Bergisch Gladbach Urspr?ngliche Nachricht Von: Simon Slavin Datum:07.02.2016 22:49 (GMT+01:00) An: SQLite mailing list