pub fn is_datetime_invocation_safe_for_schema(
function_name: &str,
args: &[SqliteValue],
) -> boolExpand description
Return whether an evaluated built-in date/time call is safe in a schema expression whose value must remain stable for the lifetime of the schema.
SQLite’s date/time functions are conditionally deterministic. Fixed text, numeric, and row-derived values are safe, but the following forms consult wall-clock or host-local state and must not be used while maintaining an expression index, partial index, generated column, or CHECK constraint:
- an omitted time value (for example,
date()orstrftime('%Y')); nowas a time value;subsecorsubsecondin the first time-value position, where SQLite treats it as shorthand for the current time with subsecond precision;localtimeorutcin a modifier position.
The argument layout is function-specific: strftime’s format occupies
args[0], while both timediff arguments are time values and neither is a
modifier. NULLs preserve SQLite’s left-to-right short-circuit behaviour: a
NULL encountered before a conditional feature makes the call return NULL
without consulting that feature.
Names other than the seven built-in date/time functions return true.
Callers that permit user-defined overrides must resolve function identity
before relying on this helper; a custom function merely named date is not
necessarily governed by SQLite’s built-in date/time rules.