# Badge queries using "badge\_posts" table aren't awarded for non-public categories

**URL:** <https://meta.discourse.org/t/badge-queries-using-badge-posts-table-arent-awarded-for-non-public-categories/142639>\
**Category:** Product Support\
**Tags:** badges\
**Created:** [February 26, 2020, 4:00am UTC](https://meta.discourse.org/t/badge-queries-using-badge-posts-table-arent-awarded-for-non-public-categories/142639 "2020-02-26T04:00:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [February 26, 2020, 5:04am UTC](https://meta.discourse.org/t/badge-queries-using-badge-posts-table-arent-awarded-for-non-public-categories/142639/2 "2020-02-26T05:04:48Z")

</div>

> [@Mark\_Schmucker](#):
>
> Where does the “badge\_posts” table come from, and shouldn’t the badge query use the “posts” table instead?

That table confused me for a long time. It is defined here: [discourse/lib/badge\_posts\_view\_manager.rb at main · discourse/discourse · GitHub](https://github.com/discourse/discourse/blob/master/lib/badge_posts_view_manager.rb#L6). It is a [postgres view](https://www.postgresqltutorial.com/postgresql-views/). My understanding of a view is that it is a name that is assigned to a query.

Posts in the `badge_posts` view are visible posts that are not in read restricted categories. When you moved your topics to a private category, you removed their posts from the `badge_posts` view.

---

_[View the full topic](https://meta.discourse.org/t/badge-queries-using-badge-posts-table-arent-awarded-for-non-public-categories/142639)._
