aboutsummaryrefslogtreecommitdiff
path: root/src/expr.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2016-08-04 12:35:17 +0000
committerdrh <drh@noemail.net>2016-08-04 12:35:17 +0000
commitcc15313cc9a8b6713dc9f995ccc4d4c088da55d7 (patch)
tree740036f8cd1111a679a63acbe69eb41dc87537e4 /src/expr.c
parentdd545d3bf219c13f839cfb21d0bc122c3b431d2b (diff)
downloadsqlite-cc15313cc9a8b6713dc9f995ccc4d4c088da55d7.tar.gz
sqlite-cc15313cc9a8b6713dc9f995ccc4d4c088da55d7.zip
Add the experimental SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION compile-time option.
When enabled, the "unknown function" error is suppressed for EXPLAIN and a no-op function named "unknown()" is substituted. This facilitiates using the command-line shell to analyze queries from applications that contain many application-defined functions that are not normally available to the shell. FossilOrigin-Name: b7f30a9ff20d580fdaecdcf2b644d09ad6c2575e
Diffstat (limited to 'src/expr.c')
-rw-r--r--src/expr.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/expr.c b/src/expr.c
index c6d74cfd3..74f09bbee 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -2943,6 +2943,11 @@ int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){
assert( !ExprHasProperty(pExpr, EP_IntValue) );
zId = pExpr->u.zToken;
pDef = sqlite3FindFunction(db, zId, nFarg, enc, 0);
+#ifdef SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
+ if( pDef==0 && pParse->explain ){
+ pDef = sqlite3FindFunction(db, "unknown", nFarg, enc, 0);
+ }
+#endif
if( pDef==0 || pDef->xFinalize!=0 ){
sqlite3ErrorMsg(pParse, "unknown function: %s()", zId);
break;