Would any kind soul be willing to explain the deterministic problem to me? I 
can see that having now() in a virtual column would be a waste of time as the 
virtual column value would change every time it was read but if it was being 
stored then why not?



Also, I take it deterministic udf’s can be used in virtual columns. If that’s 
the case what’s to stop you from declaring a udf as deterministic and calling 
now() inside that?



I’m obviously missing something. I’m guessing there must be code in sqlite.c 
that needs the same value returned at different times.







________________________________
From: sqlite-users <sqlite-users-boun...@mailinglists.sqlite.org> on behalf of 
Dominique Devienne <ddevie...@gmail.com>
Sent: Wednesday, October 30, 2019 9:21:12 AM
To: SQLite mailing list <sqlite-users@mailinglists.sqlite.org>
Subject: Re: [sqlite] Minor Change Request: CURRENT_* functions also have 
SQLITE_FUNC_CONSTANT ?

On Wed, Oct 30, 2019 at 8:32 AM Keith Medcalf <kmedc...@dessus.com> wrote:

> On Tuesday, 29 October, 2019 23:05, Simon Slavin <slav...@bigfraud.org>
> wrote:
> >On 30 Oct 2019, at 3:58am, Keith Medcalf <kmedc...@dessus.com> wrote:
>
> >> Before you change anything, I think that is incorrect for the various
> >> datetime functions.  I think they SHOULD be permitted in CHECK
> >> constraints and in generated always columns, whether those are stored or
> >> virtual, whether or not parameters are given since they are constant.
> >> They should not be permitted in indexes however unless they are pure
> >> (deterministic).
>
> > But can SQLite tell the difference at that stage ?  For instance,
>
> Personally, I do not see a problem with permitting them to be used
> anywhere EXCEPT in an index expression.
>

+1. I completely agree with Keith, and the use-cases he outlined are great
examples of enforcing business logic using CHECK constraints.

I especially like the fact one cannot alter these stored generated values,
again adding a level of integrity to the DB. --DD
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to