SQLite

View Ticket
Login
2021-03-16
18:42 Fixed ticket [2c6c8689]: Non-deterministic date/time function identified as deterministic. plus 5 other changes (artifact: 7a5eabea user: drh)
18:41
Date/time functions with no arguments (ex: date() or time()) should be non-deterministic. Fix for ticket [2c6c8689fb5f3d2f]. (check-in: 1734c332 user: drh tags: trunk)
18:27 New ticket [2c6c8689] Non-deterministic date/time function identified as deterministic.. (artifact: 35992390 user: drh)

Ticket Hash: 2c6c8689fb5f3d2fccc855620ef6bb5e0f8c6d61
Title: Non-deterministic date/time function identified as deterministic.
Status: Fixed Type: Code_Defect
Severity: Minor Priority: Low
Subsystem: Unknown Resolution: Fixed
Last Modified: 2021-03-16 18:42:42
Version Found In: 3.35.1
User Comments:
drh added on 2021-03-16 18:27:43:

Since SQLite version 3.20.0 (2017-08-01), date/time functions have been allowed in contexts that require deterministic functions as long as they did not make use of 'now', 'localtime', or 'utc' keywords since it was assumed that the date-time functions would be deterministic without those keywords. However, as forum thread 28ab8d7150?t=h demonstrates, a date/time function with no arguments can also be non-deterministic. This results in illegal schemas like:

CREATE TABLE t1(a, b AS (datetime()));
CREATE TABLE t2(x CHECK( x<julianday() ));