Index: wp-includes/query.php
===================================================================
--- wp-includes/query.php	(revision 11959)
+++ wp-includes/query.php	(working copy)
@@ -2076,8 +2076,10 @@
 			$where .= " AND $wpdb->posts.post_type = '$post_type'";
 		} elseif ( $this->is_attachment ) {
 			$where .= " AND $wpdb->posts.post_type = 'attachment'";
+			$post_type = 'attachment';
 		} elseif ($this->is_page) {
 			$where .= " AND $wpdb->posts.post_type = 'page'";
+			$post_type = 'page';
 		} else {
 			$where .= " AND $wpdb->posts.post_type = 'post'";
 			$post_type = 'post';
