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 whether function is deterministic or not.
It is rather about how aliases should work. To prove it I have found
"alias.test" in test folder. There is a comment: 
# Aliases are currently evaluated twice.  We might try to change this
# in the future.  But not now.

The test is quite old, but still doesn't work.
Moreover, consider query: SELECT x, rand() as random FROM tab WHERE random >
Currently, it would return random numbers which might be less than 0.5 due
to two calls of rand(x).

Sent from:
sqlite-users mailing list

Reply via email to