On 10/29/19, Keith Medcalf <kmedc...@dessus.com> wrote:
>>sqlite3
> SQLite version 3.31.0 2019-10-29 16:18:45
> Enter ".help" for usage hints.
> Connected to a transient in-memory database.
> Use ".open FILENAME" to reopen on a persistent database.
> sqlite> create table x(data, createdon default (current_timestamp),
> updatedon as (current_timestamp) stored);
> Error: non-deterministic functions prohibited in generated columns
> sqlite> create table x(data, createdon default (current_timestamp),
> updatedon as (datetime()) stored);
> sqlite> insert into x (data) values ('data 1');
> sqlite> select * from x;
> data 1|2019-10-30 00:45:49|2019-10-30 00:45:49
> sqlite> update x set data='data 2' where data='data 1';
> sqlite> select * from x;
> data 2|2019-10-30 00:45:49|2019-10-30 00:46:32
>
> The datetime() function has SQLITE_SLOCHNG and SQLITE_FUNC_CONSTANT, but the
> CURRENT_TIMESTAMP/CURRENT_TIME/CURRENT_DATE only have SQLITE_SLOCHNG.
>
> This means that you can use DATETIME() in a generate always ... stored but
> not CURRENT_TIMESTAMP, even though both produce the same result.  Can the
> SQLITE_FUNC_CONSTANT attribute be added to the CURRENT_* functions since the
> value is constant during the running of a single statement?
>
> --
> The fact that there's a Highway to Hell but only a Stairway to Heaven says a
> lot about anticipated traffic volume.
>
>
>
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to