-C More\sbug\sfixes\sto\sthe\stest_regexp.c\smodule.\s\sBring\stest_regexp.c\sinto\salignment\nwith\sthe\sregexp.c\sfile\sin\sthe\sFossil\ssources.
-D 2013-01-05T17:17:21.332
+C Do\snot\sraise\san\serror\sif\san\sunknown\sSQL\sfunction\sis\sfound\sin\sa\sCHECK\sconstraint\swhile\sparsing\sthe\sschema\sof\san\sexisting\sdatabase.
+D 2013-01-07T13:26:23.647
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in a48faa9e7dd7d556d84f5456eabe5825dd8a6282
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
F src/prepare.c 931ad0d852a0df48f79adcba6ce79ca5f475625c
F src/printf.c 4a9f882f1c1787a8b494a2987765acf9d97ac21f
F src/random.c cd4a67b3953b88019f8cd4ccd81394a8ddfaba50
-F src/resolve.c 521bdc0f6c7cf8246c0b9167d726d84005097c30
+F src/resolve.c e41ccbe4e01b1dc22479317a8e0184dff206c61c
F src/rowset.c 64655f1a627c9c212d9ab497899e7424a34222e0
F src/select.c 395e458a6dc611cbe1179f424753f0c344957607
F src/shell.c 11c9611580bb2ffce3a232f31f7f8cc310df0843
F test/capi3d.test 17b57ca28be3e37e14c2ba8f787d292d84b724a1
F test/capi3e.test f7408dda65c92b9056199fdc180f893015f83dde
F test/cast.test 4c275cbdc8202d6f9c54a3596701719868ac7dc3
-F test/check.test 193f47ed43a8d29aca12b30cd30ceb105fbe710d
+F test/check.test 2eb93611139a7dfaed3be80067c7dc5ceb5fb287
F test/coalesce.test cee0dccb9fbd2d494b77234bccf9dc6c6786eb91
F test/collate1.test fd02c4d8afc71879c4bb952586389961a21fb0ce
F test/collate2.test 04cebe4a033be319d6ddbb3bbc69464e01700b49
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac
-P e9ac5339603766c120c775bda8ae816d0ccb1503
-R b07326038178e7051b1863f2d68963fe
-U drh
-Z 66007f41514d49327911f47fbc5d3001
+P 7695b88fe0d73fd0a36fb7d8f95350b80615a89e
+R 9a3bff9cb6013200a01cbc0ed4f44558
+U dan
+Z 791019463b5aabd6eb50149b1f94afdd
-7695b88fe0d73fd0a36fb7d8f95350b80615a89e
\ No newline at end of file
+0a1207c895d9f77586a3a2a4965175909be90503
\ No newline at end of file
int auth; /* Authorization to use the function */
int nId; /* Number of characters in function name */
const char *zId; /* The function name. */
- FuncDef *pDef; /* Information about the function */
u8 enc = ENC(pParse->db); /* The database encoding */
testcase( pExpr->op==TK_CONST_FUNC );
assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
zId = pExpr->u.zToken;
nId = sqlite3Strlen30(zId);
- pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0);
- if( pDef==0 ){
- pDef = sqlite3FindFunction(pParse->db, zId, nId, -2, enc, 0);
+ if( pParse->db->init.busy==0 ){
+ FuncDef *pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0);
if( pDef==0 ){
- no_such_func = 1;
+ pDef = sqlite3FindFunction(pParse->db, zId, nId, -2, enc, 0);
+ if( pDef==0 ){
+ no_such_func = 1;
+ }else{
+ wrong_num_args = 1;
+ }
}else{
- wrong_num_args = 1;
+ is_agg = pDef->xFunc==0;
}
- }else{
- is_agg = pDef->xFunc==0;
- }
#ifndef SQLITE_OMIT_AUTHORIZATION
- if( pDef ){
- auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);
- if( auth!=SQLITE_OK ){
- if( auth==SQLITE_DENY ){
- sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
- pDef->zName);
- pNC->nErr++;
+ if( pDef ){
+ auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0);
+ if( auth!=SQLITE_OK ){
+ if( auth==SQLITE_DENY ){
+ sqlite3ErrorMsg(pParse, "not authorized to use function: %s",
+ pDef->zName);
+ pNC->nErr++;
+ }
+ pExpr->op = TK_NULL;
+ return WRC_Prune;
}
- pExpr->op = TK_NULL;
- return WRC_Prune;
}
- }
#endif
+ }
if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){
sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId);
pNC->nErr++;
set testdir [file dirname $argv0]
source $testdir/tester.tcl
+set ::testprefix check
# Only run these tests if the build includes support for CHECK constraints
ifcapable !check {
}
+#--------------------------------------------------------------------------
+# If a connection opens a database that contains a CHECK constraint that
+# uses an unknown UDF, the schema should not be considered malformed.
+# Attempting to modify the table should fail (since the CHECK constraint
+# cannot be tested).
+#
+reset_db
+proc myfunc {x} {expr $x < 10}
+db func myfunc myfunc
+
+do_execsql_test 7.1 { CREATE TABLE t6(a CHECK (myfunc(a))) }
+do_execsql_test 7.2 { INSERT INTO t6 VALUES(9) }
+do_catchsql_test 7.3 { INSERT INTO t6 VALUES(11) } {1 {constraint failed}}
+
+do_test 7.4 {
+ sqlite3 db2 test.db
+ execsql { SELECT * FROM t6 } db2
+} {9}
+
+do_test 7.5 {
+ catchsql { INSERT INTO t6 VALUES(8) } db2
+} {1 {unknown function: myfunc()}}
+
+do_test 7.6 {
+ catchsql { CREATE TABLE t7(a CHECK (myfunc(a))) } db2
+} {1 {no such function: myfunc}}
+
+do_test 7.7 {
+ db2 func myfunc myfunc
+ execsql { INSERT INTO t6 VALUES(8) } db2
+} {}
+
+do_test 7.8 {
+ db2 func myfunc myfunc
+ catchsql { INSERT INTO t6 VALUES(12) } db2
+} {1 {constraint failed}}
+
+
finish_test