I was just about to file a bug about a segfault when I have an aggregate in the where clause like:
select id from test where avg(rating) > 10 group by id; But when I looked in the bug reports, I found that several similar bugs had been reported and that the problem had been 'fixed': http://www.sqlite.org/cvstrac/chngview?cn=2769 Unfortunately, the fix just makes it illegal to do. Is this the permanent state, or just a placeholder until a further fix is made? The workaround of putting the aggregate in a subselect works fine: select id from (select id, avg(rating) as average from test where average > 10); So I'm not really encumbered by it. But at a glance I would think the optimizer could just 'optimize' the original to the form that works. Or is that harder than it looks? Just wondering, --nate