# Staff tags cause duplicate tag index

**URL:** <https://meta.discourse.org/t/staff-tags-cause-duplicate-tag-index/292072>\
**Category:** Bug\
**Tags:** tags\
**Created:** [2024 年1 月 18 日 13:12 UTC](https://meta.discourse.org/t/staff-tags-cause-duplicate-tag-index/292072 "2024-01-18T13:12:10Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

作者： ![hellekin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/hellekin/32/51636_2.png) [@hellekin](https://meta.discourse.org/u/hellekin)\
发布日期： [2024 年1 月 30 日 09:48 UTC](https://meta.discourse.org/t/staff-tags-cause-duplicate-tag-index/292072/2 "2024-01-30T09:48:17Z")

</div>

所有新用户现在都有一个重复条目，必须从控制台中删除：

```plaintext
 r = TagUser.connection.execute("SELECT user_id, tag_id, count(*) FROM tag_users GROUP BY tag_id, user_id HAVING count(*) > 1")
r.values.each { |uid,tag,_| TagUser.where(user_id: uid, tag_id: tag).last.destroy }

```

---

_[View the full topic](https://meta.discourse.org/t/staff-tags-cause-duplicate-tag-index/292072)._
