I have a following query in SQLite:
CREATE TABLE `table` (
`id` text PRIMARY KEY,
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
);
For some reason, CURRENT_TIMESTAMP
is treated as a string literal and creating new rows would insert a "CURRENT_TIMESTAMP"
instead of a calculated timestamp.
I encountered this issue in Turso and tried different combinations like (CURRENT_TIMESTAMP)
so I though it might be the issue of their variation of SQLite – libsql but it turns out that I encountered this problem on another environment too. You should be able to reproduce this behaviour in https://sqliteonline.com/.
In fact, there’s more to that because I couldn’t get functions like datetime()
or strftime()
to work either.
Any idea what could be the problem here?