Re: [sqlite] Bug due to left join strength reduction optimization?

2019-02-05 Thread Danny
R Smith writes: > As a matter of interest - what happens when the aliasing is taken out of > the loop and the query changes to: > > CREATE TABLE tab (id INT); > INSERT INTO tab VALUES (1); > SELECT 1 >FROM tab LEFT JOIN tab AS tab2 ON 0 >WHERE (tab2.id IS NOT NULL) = 0 > ; > > I don't

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread D Burgess
On Wed, Feb 6, 2019 at 11:26 AM Keith Medcalf wrote: "you have not normalized the data before storing it" This is true of most of the hundreds, if not thousands, of schema that I have seen. ___ sqlite-users mailing list

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread Keith Medcalf
On Tuesday, 5 February, 2019 15:12, Gerlando Falauto wrote: > I could've just used directories and logfiles instead of abusing > a relational database but I just thought it would more convenient > to issue a query and use a cursor. Well, the "abusing a relational database" is the correct

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread Simon Slavin
On 5 Feb 2019, at 10:12pm, Gerlando Falauto wrote: > I actually started off with source1,source2,ts as the primary key and for > some reason (which I no longer remember) I thought it would be wise to use a > ROWID and add an index instead. That is probably the right solution. There are

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread Gerlando Falauto
Hi Ryan, first of all thank you for your patience and contribution. [] > > Add to that the fact that an SQLite TABLE is, in and of itself, nothing > less than a covering Index with row_id as a key (or a custom key for > WITHOUT ROWID tables), and as such it is a rather good Index and a >

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread R Smith
On 2019/02/05 4:46 PM, Simon Slavin wrote: On 5 Feb 2019, at 8:59am, Rowan Worth wrote: What is stopping sqlite's query planner from taking advantage of the index, which it has chosen to use for the query, to also satisfy the ORDER BY? I suspect that, given the data in the table, the

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Scott
Last reply... I figured out the cause. I had a Regex to validate but there was a second validation I forgot about with a DateTime object check causing the issue - so blank was defaulting. I removed it and no issue. Thanks! Scott ValleryEcclesiastes 4:9-10 On Tuesday, February 5, 2019,

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Simon Slavin
On 5 Feb 2019, at 4:58pm, Shawn Wagner wrote: > Reread the rules at the start of 3.1. TIME doesn't have any of the > substrings used to indicate a particular other affinity, so it's treated as > NUMERIC. You're right. I somehow remembered the default as TEXT, not NUMERIC. I was wrong.

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Scott
Hi Simon... Thanks, I do have my  moments! LOL! I have a Regex on the GUI limiting the user to hh:mm:ss format or simply blank. Somehow that must be getting translated into a full date and time as default when blank. Scott ValleryEcclesiastes 4:9-10 On Tuesday, February 5, 2019, 11:55:47

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Shawn Wagner
Reread the rules at the start of 3.1. TIME doesn't have any of the substrings used to indicate a particular other affinity, so it's treated as NUMERIC. On Tue, Feb 5, 2019, 8:53 AM Simon Slavin On 5 Feb 2019, at 4:11pm, David Raymond wrote: > > > "Time(8)" ends up as numeric affinity for that

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Simon Slavin
On 5 Feb 2019, at 4:45pm, Scott wrote: > I think I understand now and I'm using SQLite Studio. It appears SQLite > Studio is acting as a enhanced wrapper around SQLite3. That makes a lot more sense. Well done for figuring it out. You have lots of options on how to store your dates. You can

[sqlite] Email bounce

2019-02-05 Thread Marc L. Allen
Everyone, I apologize for the email bounce notifications. My company was acquired a few months back and they’re trying to move us to their email system, so they’re trying to support two email addresses. I hope it’s only for the day, but if it becomes a burden, I can unsubscribe and come back

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Simon Slavin
On 5 Feb 2019, at 4:11pm, David Raymond wrote: > "Time(8)" ends up as numeric affinity for that field. The table in 3.1.1 shows how SQLite recognises the type you supply and turns it into a type it can use. The lowest row of the table shows that "DATETIME" is recognised as NUMERIC.

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Scott
Hi David! I think I know what direction I need to go and this helps and makes sense. I may simply need to figure out what is sending the "Thu Jan 01 00:00:00 EST 1970" and handle it from there. Thanks! Scott ValleryEcclesiastes 4:9-10 On Tuesday, February 5, 2019, 11:11:56 AM EST, David

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Scott
I think I understand now and I'm using SQLite Studio.  It appears SQLite Studio is acting as a enhanced wrapper around SQLite3.  I did some reading and there is a SQLite Studio manual with with a list of 16 data types and it looks as if you can configure editors around those data types. I

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread David Raymond
https://www.sqlite.org/datatype3.html#determination_of_column_affinity "Time(8)" ends up as numeric affinity for that field. When it's given the string "Thu Jan 01 00:00:00 EST 1970" to store in the numeric field, that string can't be losslessly converted to a number, and thus it leaves it

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Simon Slavin
On 5 Feb 2019, at 3:29pm, Scott wrote: > Thanks for the timely response. I provided below the details. "Time(8)" is > the generated description of the structure defined by SQLite3 based upon Data > Type options. So I apologize if I don't understand you comment. SQLite didn't generate

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Scott
Hi Tim! "Time(8) has no meaning to SQLite" Thanks for the timely response. I provided below the details. "Time(8)" is the generated description of the structure defined by SQLite3 based upon Data Type options. So I apologize if I don't understand you comment. Thanks! Column Data Type

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread Simon Slavin
On 5 Feb 2019, at 8:59am, Rowan Worth wrote: > SELECT source1, source2, ts, value > FROM rolling > WHERE source1 = 'aaa' > AND ts > 1 AND ts < 1 > ORDER BY source1, source2, ts; > > And this index: > > CREATE INDEX `sources` ON `rolling` ( >`source1`, >`source2`, >`ts` >

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread Gerlando Falauto
Hi Rowan, thank you for your kind support. You grasped the essence of my questions. :-) I'm using SQLite 3.25.00. Thank you, Gerlando On Tue, Feb 5, 2019 at 9:59 AM Rowan Worth wrote: > On Tue, 5 Feb 2019 at 16:06, Simon Slavin wrote: > > > On 5 Feb 2019, at 8:00am, Gerlando Falauto > >

Re: [sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Tim Streater
On 05 Feb 2019, at 13:08, Scott wrote: > I have a Comment table with the fields: CommentID, Summary, Comment, Pages, > TimeStamp, Hyperlink. The TimeStamp field is setup as a Time(8), time with 8 > characters only. Not every comment in this table requires a timestamp, so it > should remain null.

[sqlite] My TimeStamp field keeps populating though I don't write anything to it

2019-02-05 Thread Scott
I have a Comment table with the fields: CommentID, Summary, Comment, Pages, TimeStamp, Hyperlink. The TimeStamp field is setup as a Time(8), time with 8 characters only. Not every comment in this table requires a timestamp, so it should remain null. However, it has started adding "Thu Jan 01

Re: [sqlite] [EXTERNAL] Re: Bug due to left join strength reduction optimization?

2019-02-05 Thread Hick Gunter
We have an input table named tab with a single row whose sole column named id as a value of 1. This table is joined to itself in a left join. The cartesian product would be tab.id tab2.id 1 1 The clause ON 0 evaluates to FALSE, so the row is eliminated from the result set. LEFT JOIN

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread Rowan Worth
On Tue, 5 Feb 2019 at 16:06, Simon Slavin wrote: > On 5 Feb 2019, at 8:00am, Gerlando Falauto > wrote: > > > Thank you for your explanations guys. All this makes perfect sense. > > I still can't find a solution to my problem though -- write a query that > is guaranteed to return sorted results,

Re: [sqlite] Bug due to left join strength reduction optimization?

2019-02-05 Thread R Smith
On 2019/02/05 10:13 AM, Dominique Devienne wrote: On Tue, Feb 5, 2019 at 7:47 AM Keith Medcalf wrote: sqlite> select ... from tab left join tab as tab2 on 0 ... Can someone please educate me on this {{ on 0 }} join "condition" ? I'm not following what the intended meaning is... Must have

Re: [sqlite] Displaying hierarchical structure

2019-02-05 Thread Clemens Ladisch
Bart Smissaert wrote: > ID PARENT_ID FOLDER RANK > --- > 1 0 Main1 > 2 1 CC 1-02 > 3 1 BB 1-03 > 4 1

Re: [sqlite] Bug due to left join strength reduction optimization?

2019-02-05 Thread Dominique Devienne
On Tue, Feb 5, 2019 at 7:47 AM Keith Medcalf wrote: > sqlite> select ... from tab left join tab as tab2 on 0 ... > Can someone please educate me on this {{ on 0 }} join "condition" ? I'm not following what the intended meaning is... Must have one, since OP "expects 1 row with one column

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread Simon Slavin
On 5 Feb 2019, at 8:00am, Gerlando Falauto wrote: > Thank you for your explanations guys. All this makes perfect sense. > I still can't find a solution to my problem though -- write a query that is > guaranteed to return sorted results, in some optimal way. Please state your table definition,

Re: [sqlite] Min/Max and skip-scan optimizations

2019-02-05 Thread Gerlando Falauto
Thank you for your explanations guys. All this makes perfect sense. I still can't find a solution to my problem though -- write a query that is guaranteed to return sorted results, in some optimal way. Any suggestion welcome. Thank you, Gerlando Il lun 4 feb 2019, 22:24 Simon Slavin ha