On 2016/03/06 1:24 AM, Stephan Beal wrote:
> On Sat, Mar 5, 2016 at 11:58 PM, Richard Hipp <drh at sqlite.org> wrote:
>
>> On 3/5/16, Stephan Beal <sgbeal at googlemail.com> wrote:
>>> On Sat, Mar 5, 2016 at 10:43 PM, Domingo Alvarez Duarte <
>>>
>>> The scenario i'm concerned about is that sqlite calls my aggregate N
>> times,
>>> then an error is triggered elsewhere which keeps sqlite from making the
>>> final() aggregate call.
>> IIRC, SQLite always calls the final() function.  Even after an error.
>>
> Perfect :). Thank you!

I can confirm this too, but don't just accept that - test it!  It's a 
relatively easy test and as long as it works like that for most cases, 
you don't need to be concerned with weirdly outlying corner case fails - 
chances are, in those circumstances, more would go wrong than just your 
current query.

Also, best to keep a list of resource pointers indexed by the DB pointer 
sent by sqlite API and/or perhaps the statement pointer. That way things 
can never mix or produce wrong answers and the worst case some resource 
can survive for longer than needed.

Reply via email to