On Mon, Feb 17, 2014 at 6:23 PM, RSmith <rsm...@rsweb.co.za> wrote: > The flag is telling SQLite that your function will behave > determinsitcally, i.e. it won't change the output for the same inputs > within a single query. >
i figured so, just wanted to be sure. > SQLite then uses this information to "maybe" cache the output and re-use > it, but there is no guarantee the optimisation is possible within every > query situation, so it is very much possible SQLite can call your function > again within the same query, you have to make your function behave > deterministically if you tell SQLite that it is so - else query results can > be undefined. > But it would be really handy if sqlite3 could somehow guaranty that the optimization would apply :). (No, i'm not asking for that as a feature - it doesn't sound feasible to me for all query constructs.) > The OP seems to have "tested" SQLite's determinism with adding a very > indeterministic function, so what I was trying to point out is either his > function isn't behaving deterministically and/or he did not specify the > flag to let SQLite know - It was your response to that which lead me to that flag - i wasn't aware of it before and wanted to double-check before i go applying it to my local now() impl (which i "now" won't do, of course). But... i can set it on 5 or 6 others which do behave deterministically, so thank you for that :). but to your question specifically, no the flag does not force determinism > (AFAICT), That coincides with Richard's answer (which i consider to be definitive ;). > it only allows the optimisation But it "would be cool if..." ;) -- ----- stephan beal http://wanderinghorse.net/home/stephan/ http://gplus.to/sgbeal "Freedom is sloppy. But since tyranny's the only guaranteed byproduct of those who insist on a perfect world, freedom will have to do." -- Bigby Wolf _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users