Hacker News new | ask | show | jobs
by petilon 19 days ago
Right, and that's the problem. There should be DATE and BOOL as well, especially in strict mode.
2 comments

I don't understand what this has to do with strict mode? Yes those types should exist, but the workaround is to use an integer column for bool and a text column for date, whether or not you're using strict mode.
The point of strict mode is that the RDBMS performs data type validation when inserting/updating data. If you use a text column for storing dates, you can store any string in the column, not just valid dates. That's not strict.
Yeah the parse rules for strict tables are annoying but it doesn't change the underlying semantics:

  sqlite> create table test (
    id integer primary key,
    created_at text default current_timestamp,
    flag integer not null default 0 check (flag in (0, 1))
  ) strict;
  sqlite> insert into test (flag) values (1);

  sqlite> select * from test;
  ╭────┬─────────────────────┬──────╮
  │ id │     created_at      │ flag │
  ╞════╪═════════════════════╪══════╡
  │  1 │ 2026-07-12 04:03:22 │    1 │
  ╰────┴─────────────────────┴──────╯