1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Always disallow the use of non-deterministic functions in CHECK constraints,

even date/time functions that use the 'now' or similar keywords.  Provide
improved error messages when this requirement is not met.
Ticket [830277d9db6c3ba1]

FossilOrigin-Name: 2978b65ebe25eeabe543b67cb266308cceb20082a4ae71565d6d083d7c08bc9f
This commit is contained in:
drh
2019-10-30 18:50:08 +00:00
parent 920cf596e6
commit 20cee7d0bb
10 changed files with 104 additions and 55 deletions

View File

@ -502,11 +502,13 @@ int sqlite3_totype_init(
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */
rc = sqlite3_create_function(db, "tointeger", 1, SQLITE_UTF8, 0,
tointegerFunc, 0, 0);
rc = sqlite3_create_function(db, "tointeger", 1,
SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
tointegerFunc, 0, 0);
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(db, "toreal", 1, SQLITE_UTF8, 0,
torealFunc, 0, 0);
rc = sqlite3_create_function(db, "toreal", 1,
SQLITE_UTF8 | SQLITE_DETERMINISTIC, 0,
torealFunc, 0, 0);
}
return rc;
}