On 14/8/19 8:46 PM, Adrian Ho wrote: > On 14/8/19 8:33 PM, Clemens Ladisch wrote: >> CREATE TABLE t ( >> date date CHECK (date = date(date, '+0 days')) >> ); > Sadly, this isn't sufficient for guarding against malformed dates like > '2019-02-00' and '2019-02-1' that the OP listed, because the CHECK > expression in those cases resolves to NULL, which does *not* signal a > constraint violation. > > Instead, you have to "round-trip" the date conversion manually, and > check that the intermediate Julian conversion IS NOT NULL, for this > CHECK to be truly effective. Or use the IS operator instead, which slipped my mind. 8-)
-- Best Regards, Adrian _______________________________________________ sqlite-users mailing list [email protected] http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

