Hello!

The simple regexp function example:
select value from t1 where user_regexp_multi(value,'\d{1}','\s+')=1;

The function user_regexp_multi(value,regexp1,...,regexpN) will recompile the 
regexp by every call becouse auxdata API cleaning the
function-context auxdata too often. And thus we use application-defained 
user_regexp becouse SQLite auxdata-based user function 
has no the promised performance improvement. In this example the regexp 
expressions may be compiled only once.

And similar example has this problem:
select value from t1 where user_regexp(value,(select pattern from t where 
name='postalcode-russia'))=1;

By this patch the problem will be resolved:

--- vdbe.c.orig 2009-12-20 13:28:43.000000000 +0300
+++ vdbe.c  2009-12-20 13:28:53.000000000 +0300
@@ -1417,7 +1417,7 @@
   ** immediately call the destructor for any non-static values.
   */
   if( ctx.pVdbeFunc ){
-    sqlite3VdbeDeleteAuxData(ctx.pVdbeFunc, pOp->p1);
     pOp->p4.pVdbeFunc = ctx.pVdbeFunc;
     pOp->p4type = P4_VDBEFUNC;
   }

It's not a problem to manual clean auxdata when these are not needed by now. 
The auto clean is really helpful only when the query
did finalize.

Best regards, Alexey Pechnikov.
http://pechnikov.tel/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to