When I'm looking at Posts > Categories in the admin panel, I see that there are 17 posts associated with the category slug "vegetarian". If I click the number, and look at the posts it correctly shows 17 vegetarian posts. Clicking on quick edit confirms that the category "vegetarian" is checked for all 17 posts.
When I look in my XX_terms table, I can see that slug "vegetarian" is associated with term_id 1828. However When I look at the XX_term_relationships table and search for rows with the term_taxonomy_id = 1828, I only get 1 record, which is a non-vegetarian image.
Shouldn't there be 17 records in term_taxonomy_id mapping to the vegetarian posts? If something is totally broken in the database, why does it all show up correctly in the admin panel and on the site?
I never would have even noticed the problem except that I'm trying to run a plugin that lists all posts by category and I was getting vague errors, so I did some digging in the database.