Re: Fwd: inserting new data only

David Raymond <[email protected]> Tue, 25 Feb 2020 19:30:59 +0000
Newsgroups gmane.comp.db.sqlite.general
Message-ID <VI1PR07MB602934262DD945D9267E693787ED0@VI1PR07MB6029.eurprd07.prod.outlook.com>
Awesome---exactly what's needed.
The monotonicity of the time key variable is assured by how the data
is collected---but  is there a way to express that in sqlite?
create table data (
  key text primary key check
(julianday(key) > julianday(select max(key) from data),
  data integer not null);


That would/should be done in a trigger, and not a check constraint. A check constraint is only supposed to be something which will _always_ be true about that one and only record, and which only needs the contents of that 1 record to determine, and not something that might change depending on... anything else.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users