OK, I somewhat figured out what's going on. The query is tacking on the current year for every query for some reason.
Here's an example of a query when I uncomment line #319 in wp-blog-header.php:
SELECT DISTINCT * FROM b2posts WHERE 1=1 AND YEAR(post_date)=2003 AND MONTH(post_date)=10 AND YEAR(post_date)=2004 AND post_date <= '2004-01-13 14:09:46' AND (post_status = "publish") ORDER BY post_date DESC
Note the presence of two "YEAR(post_date)", one being the current year! Digging further:
wp-blog-header.php, line 68-87:
---
if ($m != '') {
$m = ''.intval($m);
$where .= ' AND YEAR(post_date)='.substr($m,0,4);
if (strlen($m)>5)
$where .= ' AND MONTH(post_date)='.substr($m,4,2);
if (strlen($m)>7)
$where .= ' AND DAYOFMONTH(post_date)='.substr($m,6,2);
if (strlen($m)>9)
$where .= ' AND HOUR(post_date)='.substr($m,8,2);
if (strlen($m)>11)
$where .= ' AND MINUTE(post_date)='.substr($m,10,2);
if (strlen($m)>13)
$where .= ' AND SECOND(post_date)='.substr($m,12,2);
}
if ($year != '') {
$year = '' . intval($year);
$where .= ' AND YEAR(post_date)=' . $year;
}
---
OK, so where is $year set initially? If I comment out lines 84 & 87, archives work fine. I need $year to be initially empty it seems, and it's not. Ideas?