Hi,
Using the precompiled CLI for MacOS (10.13.6) I stumbled upon the following to
do
with the date() function:
sqlite> .version
SQLite 3.29.0 2019-07-10 17:32:03
fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6
zlib version 1.2.11
clang-10.0.1
sqlite> select date('2019-02-00'); -- null
sqlite> select date('2019-02-01'); -- ok
2019-02-01
sqlite> select date('2019-02-1' ); -- null
sqlite> select date('2019-02-29'); -- not a leap year
2019-02-29
sqlite> select date('2019-02-31'); -- ?
2019-02-31
sqlite> select date('2019-02-32'); -- null
sqlite> .quit
It seems the date function does not check that the date is valid, only the
format.
Regardless of month it accepts day numbers from '01' to '31'.
Consequently, I would appreciate any advice on the preferred way to specify a
CREATE TABLE .. CHECK clause
to guard inserting a yyyy-mm-dd date into a text field.
Thanks, Martin.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users