Martin wrote:
> sqlite> select date('2019-02-29');  -- not a leap year
> 2019-02-29

> 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.

sqlite> select date('2019-02-29', '+0 days');
2019-03-01

CREATE TABLE t (
  date date  CHECK (date = date(date, '+0 days'))
);

(This also ensures that the date is not in Julian day format.)


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

Reply via email to