Re: [sqlite] Issue with sqlite3_result_error inside aggregatefunction
* D. Richard Hipp: If an error occurs in a step function, record that fact in the aggregate context. Then when the finalizer is called, check the error flag in the context and call sqlite3_result_error at that point if it is appropriate to do so. Does this really work? According to my experiments, the fact that sqlite3_result_error has been called from the finalizer is ignored. The sources seem to lack the appropriate check, but I'm not sure.
Re: [sqlite] Issue with sqlite3_result_error inside aggregatefunction
* Nathan Kurz: On Wed, Nov 16, 2005 at 01:16:40PM +0100, Florian Weimer wrote: * D. Richard Hipp: If an error occurs in a step function, record that fact in the aggregate context. Then when the finalizer is called, check the error flag in the context and call sqlite3_result_error at that point if it is appropriate to do so. Does this really work? According to my experiments, the fact that sqlite3_result_error has been called from the finalizer is ignored. The sources seem to lack the appropriate check, but I'm not sure. I haven't looked at the code that handles it, but in practice it seems that an error returned from the step function is noticed and aborts the query, but gives only the non-descript error message: SQL logic error or missing database. An error returned from the final function is ignored, and the string of the error message is used as the result. Thanks for the confirmation, so I'm not imagining things. Unfortunately, signaling errors from the step function causes a segmentation fault on my system (actually, I tested this only through the apsw Python wrapper, which indirectly sparked this thread). It's not a terribly important issue for me at this stage, I just spotted it while writing test cases for some of my own code.
Re: [sqlite] Issue with sqlite3_result_error inside aggregatefunction
You should not call sqlite3_result_* from within the step function of an aggregate. Those routines may be called from within the finalizer function only. Could you add some sort of assertion so that it is caught if the functions are called? So what should I do if an error occurs? Since I am ultimately running a user provided Python function there is always the possibility of an error happening. Roger
Re: [sqlite] Issue with sqlite3_result_error inside aggregatefunction
On Tue, 2005-09-27 at 08:33 -0700, Roger Binns wrote: You should not call sqlite3_result_* from within the step function of an aggregate. Those routines may be called from within the finalizer function only. So what should I do if an error occurs? Since I am ultimately running a user provided Python function there is always the possibility of an error happening. If an error occurs in a step function, record that fact in the aggregate context. Then when the finalizer is called, check the error flag in the context and call sqlite3_result_error at that point if it is appropriate to do so. -- D. Richard Hipp [EMAIL PROTECTED]