[sqlite] Warnings for non-deterministic queries?

2015-11-28 Thread Simon Slavin
On 28 Nov 2015, at 4:19pm, Keith Medcalf wrote: > The long and the short of it is that the result is exactly correct (and > *always* entirely predictable). The /result/ is exactly correct and entirely predictable. If you consider the result to be just the thing you asked for. How you get

[sqlite] Warnings for non-deterministic queries?

2015-11-28 Thread R Smith
On 2015/11/27 9:58 PM, Simon Slavin wrote: > On 27 Nov 2015, at 6:30pm, R Smith wrote: > >> Let me explain better, let's assume the query contains MAX(x)... The result >> will be from whichever row contains the max, and if the x was not in the >> aggregate function, it will be from some row

[sqlite] Warnings for non-deterministic queries?

2015-11-28 Thread Keith Medcalf
> Indeed you are correct - pardon me not making it clearer - the point was > to demonstrate using an example that would "feel" deterministic and show > that even in that case the arbitrary-pick should be expected or catered > for. Your example further highlights this (and is probably the more >

[sqlite] Warnings for non-deterministic queries?

2015-11-27 Thread Török Edwin
On 11/27/2015 08:30 PM, R Smith wrote: > > > On 2015/11/27 4:44 PM, Adam Devita wrote: >> I think the OP meant to write: >> "If the expression is an aggregate expression, it is evaluated across >> all rows in the group. Otherwise, it is evaluated against a single >> arbitrarily chosen row from

[sqlite] Warnings for non-deterministic queries?

2015-11-27 Thread Simon Slavin
On 27 Nov 2015, at 9:08pm, T?r?k Edwin wrote: > Thanks, non-deterministic was probably the wrong term to use. > I wanted to find situations where a query's result depends on an > implementation detail of SQLite, and the behaviour is not fully specified by > the

[sqlite] Warnings for non-deterministic queries?

2015-11-27 Thread Bernardo Sulzbach
On Fri, Nov 27, 2015 at 8:29 PM, Simon Slavin wrote: > > And just as you write, all the above behaviours can change in different > versions of SQLite so even if you do detailed detective work using the > current version it might all be obsolete next week. > > Simon. > Exactly. One of the

[sqlite] Warnings for non-deterministic queries?

2015-11-27 Thread R Smith
On 2015/11/27 4:44 PM, Adam Devita wrote: > I think the OP meant to write: > "If the expression is an aggregate expression, it is evaluated across > all rows in the group. Otherwise, it is evaluated against a single > arbitrarily chosen row from within the group. " > > Is there a way I could

[sqlite] Warnings for non-deterministic queries?

2015-11-27 Thread Simon Slavin
On 27 Nov 2015, at 6:30pm, R Smith wrote: > Let me explain better, let's assume the query contains MAX(x)... The result > will be from whichever row contains the max, and if the x was not in the > aggregate function, it will be from some row (which may or may not be the one > with the max

[sqlite] Warnings for non-deterministic queries?

2015-11-27 Thread Darren Duncan
On 2015-11-27 5:46 AM, Keith Medcalf wrote: >> Is there a way I could programatically determine that a query is non- >> deterministic at query prepare time? > > What do you mean, non-deterministic? The result is deterministic in all > cases. > > It may be complicated and/or difficult for you to

[sqlite] Warnings for non-deterministic queries?

2015-11-27 Thread Török Edwin
Hi, I mistakenly used the wrong side of the ON caluse in a group by clause for a query and I was wondering why SQLite didn't return the same results always: - SELECT SUM(x) FROM (SELECT files.size + LENGTH(CAST(files.name AS BLOB)) + SUM(COALESCE(LENGTH(CAST(fmeta.key AS BLOB)) +

[sqlite] Warnings for non-deterministic queries?

2015-11-27 Thread Adam Devita
I think the OP meant to write: "If the expression is an aggregate expression, it is evaluated across all rows in the group. Otherwise, it is evaluated against a single arbitrarily chosen row from within the group. " Is there a way I could programmatically determine that a query is going to use an

[sqlite] Warnings for non-deterministic queries?

2015-11-27 Thread Keith Medcalf
> Is there a way I could programatically determine that a query is non- > deterministic at query prepare time? What do you mean, non-deterministic? The result is deterministic in all cases. It may be complicated and/or difficult for you to compute, but it is always deterministic. The