SQLite Error when viewing monthly archives

When I try to view the monthly archives I get this error:

SQLite3::SQLException: near “AS”: syntax error: SELECT * FROM pages
WHERE (pages.parent_id = 4 AND ((((virtual = ‘f’) and (status_id =
100)) AND (CAST(STRFTIME(’%m’, published_at) AS INTEGER) = 6)) AND
(CAST(STRFTIME(’%Y’, published_at) AS INTEGER) = 2007))) ORDER BY
published_at DESC, virtual DESC, title ASC

My Radiant set up was setup under a custom Ruby ROR install at
Dreamhost. It is setup with the SQLite3 GEM.

Is the offending code compatible with the SQLite SQL implementation?
Does that code have to be rewritten for SQLite 3?

/voipfc