Re: [sqlite] User function's alias

2017-11-12 Thread korablev
More strange things: SELECT x, sequence() AS y FROM t1 WHERE y>0 AND y<99 order by x desc; 9, 2 8, 3 7, 4 SELECT x, 0+sequence() AS y FROM t1 WHERE y>0 AND y<99 order by x desc; 9, 6 8, 6 7, 6 Seems that this optimization a little bit broken... -- Sent from: http://sqlite.1065341.n5.nabbl

Re: [sqlite] User function's alias

2017-11-12 Thread korablev
Well, behaviour of deterministic function is really strange. SELECT x, sequence() AS y FROM t1 WHERE y>0 AND y<99 AND y!=55 AND y NOT IN (56,57,58) AND y NOT LIKE 'abc%' AND y%10==2 order by x desc (Example from alias.test, I have declared sequence() with SQLITE_DETERMINISTIC flag) Trace for the q

Re: [sqlite] User function's alias

2017-11-12 Thread korablev
Jens Alfke-2 wrote > First off, you didn’t register the function as deterministic, so SQLite > has to assume it can return a different result every time it’s called, > even with the same arguments. That immediately prevents the kind of > optimization you wanted. I guess, it doesn't really matter w

Re: [sqlite] User function's alias

2017-11-10 Thread Jens Alfke
> On Nov 10, 2017, at 9:51 AM, korablev wrote: > > I have noticed strange behaviour of user functions. Consider following > example: In reports like this, it really helps if you can clearly state the situation at the start, instead of dumping hundreds of lines of code and output, and expecti