On 14/8/19 8:47 PM, no...@null.net wrote:
>
>     CREATE TABLE table_a(
>         dt TEXT -- NOT NULL if you like
>         CONSTRAINT valid_date CHECK(dt IS date(dt,'localtime'))
>     );

Sorry, that 'localtime' qualifier is a non-starter; that will throw a
"non-deterministic function in index expression or CHECK constraint"
error
(https://www.sqlite.org/deterministic.html#special_case_processing_for_date_time_functions):

    The built-in date and time functions of SQLite are a special case.
    These functions are usually considered deterministic. However, if
    these functions use the string "now" as the date, or if they use the
    localtime modifier or the utc modifier, then they are considered
    non-deterministic. Because the function inputs are not necessarily
    known until run-time, the date/time functions will throw an
    exception if they encounter any of the non-deterministic features in
    a context where only deterministic functions are allows.


-- 
Best Regards,
Adrian

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to