4 ms·
This could enforce dates are strings. They wanted to enforce dates are dates I thought.
by pseudalopex 5mo ago
This could enforce dates are strings. They wanted to enforce dates are dates I thought.
- zimmi 5mo agoStoring dates as INTEGER (year * 10000 + month * 100 + day, e.g. 20260530) is not so bad. Proper date / timestamp types would be great though.
- mollerhoj 5mo ago"feels like using a 30years old database"
- simonw 5mo agocreate table events ( id integer primary key, name text not null, event_date text not null check ( -- YYYY-MM-DD event_date glob '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]' and date(event_date) is not null and date(event_date) = event_date ) ); In Python that raises this error if the date is invalid: sqlite3.IntegrityError: CHECK constraint failed: event_date glob '[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]'
- deleted 5mo ago[deleted]
- pseudalopex 5mo agoI see. The strict tables page did not mention the date and time functions. Python would show the 1st line always? Or the failed part? This is unreasonable for a very common type I think.