aboutsummaryrefslogtreecommitdiff
path: root/ext/misc/totype.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-10-30 18:50:08 +0000
committerdrh <drh@noemail.net>2019-10-30 18:50:08 +0000
commit20cee7d0bb8f627c3952f24a5c4772f8fbb4d720 (patch)
tree8fa04661f1fdf2da038495b7517dbfcc964a2984 /ext/misc/totype.c
parent920cf596e67ecccecb497cfa60cc65945048f866 (diff)
downloadsqlite-20cee7d0bb8f627c3952f24a5c4772f8fbb4d720.tar.gz
sqlite-20cee7d0bb8f627c3952f24a5c4772f8fbb4d720.zip
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
Diffstat (limited to 'ext/misc/totype.c')
-rw-r--r--ext/misc/totype.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/ext/misc/totype.c b/ext/misc/totype.c
index 5dc99f3d7..c9655c3db 100644
--- a/ext/misc/totype.c
+++ b/ext/misc/totype.c
@@ -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;
}