If I enter a URL such as http://www.example.com/blog/2007/12/unknown/ where there is no such post, I expect to get a 404 error. Instead, I get the following database error:
WordPress database error: [You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY p.post_date ASC LIMIT 1' at line 1]
SELECT p.ID, p.post_title FROM wp_posts AS p WHERE p.post_date > '' AND p.post_type = 'post' AND p.post_status = 'publish' AND p.ID != ORDER BY p.post_date ASC LIMIT 1