I created a table tb with the following schema:
CREATE TABLE tb (name TEXT, dt TEXT DEFAULT (date('now', 'localtime')));
Then a wrong date was inserted into tb on purpose:
INSERT INTO tb(name, dt) VALUES("somebody","2015-99-99");
It worked without any warning, and with SELECT * FROM tb I got:
somebody|2015-99-99
The date() function showed that the input was wrong, (SELECT DATE(dt) FROM tb returned nothing), but at the time of inputting we did not know the error.
Is it possible for sqlite3 to check if a timestamp input is correct or not?
(Sqlite version: 3.9.1)
Aucun commentaire:
Enregistrer un commentaire