Re: [sqlite] Possible bug with union and join.

2016-12-27 Thread Hick Gunter
no affinity, so SELECT '1' = 1; returns 0. -Ursprüngliche Nachricht- Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Don V Nielsen Gesendet: Dienstag, 27. Dezember 2016 16:18 An: SQLite mailing list Betreff: Re: [sqlite] Possible bug with union an

Re: [sqlite] Possible bug with union and join.

2016-12-27 Thread Don V Nielsen
Thanks for the correction/information! Merry Christmas and Happy New Year to you. On Tue, Dec 27, 2016 at 9:48 AM, Richard Hipp wrote: > On 12/27/16, Don V Nielsen wrote: >> Theory related question. I'm being argumentative, I know. But this >> issue is in the same category as one discussed weeks

Re: [sqlite] Possible bug with union and join.

2016-12-27 Thread Richard Hipp
On 12/27/16, Don V Nielsen wrote: > Theory related question. I'm being argumentative, I know. But this > issue is in the same category as one discussed weeks ago. > > SQLite is, in a sense, typeless. All data is stored as text (ignore > blob). Correct? It is when one casts a column to something ot

Re: [sqlite] Possible bug with union and join.

2016-12-27 Thread Don V Nielsen
Theory related question. I'm being argumentative, I know. But this issue is in the same category as one discussed weeks ago. SQLite is, in a sense, typeless. All data is stored as text (ignore blob). Correct? It is when one casts a column to something other than text that triggers SQLite to treat

Re: [sqlite] Possible bug with union and join.

2016-12-25 Thread Adrian Stachlewski
Fortunately names of columns are much more transparent and documented in our internal specification. 'Id' was created only for example, but thanks for advice :) Adrian 2016-12-25 13:44 GMT+01:00 Simon Slavin : > > On 23 Dec 2016, at 4:55pm, Adrian Stachlewski > wrote: > > > Id field in one tabl

Re: [sqlite] Possible bug with union and join.

2016-12-25 Thread Simon Slavin
On 23 Dec 2016, at 4:55pm, Adrian Stachlewski wrote: > Id field in one table is defined as TEXT, because there are stored > identifiers which can be numeric or text mostly like in the example ("4", > "4,5", "10-1") (to be precise this map is created on the fly by > concatenating some ids and na

Re: [sqlite] Possible bug with union and join.

2016-12-25 Thread Adrian Stachlewski
Simon, Id field in one table is defined as TEXT, because there are stored identifiers which can be numeric or text mostly like in the example ("4", "4,5", "10-1") (to be precise this map is created on the fly by concatenating some ids and names from another tables). In second table there are store

Re: [sqlite] Possible bug with union and join.

2016-12-23 Thread Simon Slavin
On 22 Dec 2016, at 5:55pm, Adrian Stachlewski wrote: > In this case I think that the best way to do this is cast integer column to > text. > CREATE VIEW id_map(id, name) as > SELECT CAST(id AS TEXT), name > FROM map_integer > UNION ALL > SELECT id, name > FROM map_text; In an earlier post

Re: [sqlite] Possible bug with union and join.

2016-12-23 Thread Adrian Stachlewski
Richard, Thank you for your answer. Datatypes in sqlite was always weird for me, mostly the fact that for example TEXT can be inserted in INTEGER column. In this case I think that the best way to do this is cast integer column to text. CREATE VIEW id_map(id, name) as SELECT CAST(id AS TEXT), na

Re: [sqlite] Possible bug with union and join.

2016-12-22 Thread Richard Hipp
On 12/22/16, David Raymond wrote: > Problem appears to be coming from an automatic index. Thanks for the insight, David. Automatic indexes do appear to be a factor, but not the only factor. The script below shows different answers depending on whether the VIEW is created with or without expli

Re: [sqlite] Possible bug with union and join.

2016-12-22 Thread David Raymond
:14 AM To: sqlite-users@mailinglists.sqlite.org Subject: [sqlite] Possible bug with union and join. Hi everyone. When I was working with sqlite3 I've found weird behavior of JOIN clause when I was trying to merge table with union of tables. Let me explain this using database with reproduced prob

[sqlite] Possible bug with union and join.

2016-12-22 Thread Adrian Stachlewski
Hi everyone. When I was working with sqlite3 I've found weird behavior of JOIN clause when I was trying to merge table with union of tables. Let me explain this using database with reproduced problem. Database dump: CREATE TABLE map_integer (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO "map_in

[sqlite] Possible bug with union and join.

2016-12-22 Thread Adrian Stachlewski
Hi everyone. When I was working with sqlite3 I've found weird behavior of JOIN clause when I was trying to merge table with union of tables. Let me explain this using database with reproduced problem. Database dump: CREATE TABLE map_integer (id INTEGER PRIMARY KEY, name TEXT); INSERT INTO "map_in