Make the distinction between truly deterministic functions and date/time
functions which only return the same answer for a single query.  Only truly
deterministic functions are allowed in indexes.  Add new expression index
test cases.

FossilOrigin-Name: c77554b5c42327106a7b90334e9cc3c07b007c76
diff --git a/src/resolve.c b/src/resolve.c
index eb43396..0b8dde7 100644
--- a/src/resolve.c
+++ b/src/resolve.c
@@ -732,9 +732,15 @@
           return WRC_Prune;
         }
 #endif
-        if( pDef->funcFlags & SQLITE_FUNC_CONSTANT ){
+        if( pDef->funcFlags & (SQLITE_FUNC_CONSTANT|SQLITE_FUNC_DATETIME) ){
+          /* For the purposes of the EP_ConstFunc flag, date and time
+          ** functions are considered constant because the the time does
+          ** not change for the duration of a query. */
           ExprSetProperty(pExpr,EP_ConstFunc);
-        }else{
+        }
+        if( (pDef->funcFlags & SQLITE_FUNC_CONSTANT)==0 ){
+          /* DATETIME functions are considered non-deterministic because of
+          ** the 'now' capability */
           notValid(pParse, pNC, "non-deterministic functions", NC_IdxExpr, 0);
         }
       }