SQLite Forum

CASE WHEN False THEN MyFunction() END calls MyFunction
This issue was addressed by check-in [c5f96a085db9688a][1].  Please try
again using the "Prerelease Snapshot" on the [Download Page][2] and let
us know whether or not this fixes your problem.

[1]: https://sqlite.org/src/timeline?c=c5f96a085db9688a
[2]: https://sqlite.org/download.html

If you don't want to use unreleased code, then you can omit the
SQLITE_DETERMINISTIC flag when you create MyFunction(), because it
is that flag that is provoking the optimization that causes the
function to be called even when it is not being used.