Easy way to find out what tag groups a tag is belonging?

AI-generated summary

In a Support discussion titled Easy way to find out what tag groups a tag is belonging?, Jagster shares a usability issue: after assigning a tag to an admin-only group, it remained visible to all users because it was still listed in other public tag groups. The manual process of identifying overlapping tag group assignments was tedious. JammyDodger helpfully points out that the tag’s info page (via the tag wrench/info button) already displays its associated tag groups — a feature Jagster had overlooked, humorously calling himself clueless. Still curious, Jagster asks if a SQL query could list all tags with their associated tag groups. JammyDodger provides a sample SQL query using STRING_AGG to concatenate tag group names per tag, which Jagster appreciates as a good starting point. The thread concludes with a practical solution and a lighthearted self-critique, highlighting both UI discovery and database query potential for tag management.

I have a tag that had only administration meaning. Earlier I showed it to every users, but it is basically just noise for them and no one except me was using it.

So I added it to tag group that is visible only for admins. But it was still visible to everyone. First I was thrilled because I found a bug… but no. Only bug was, again, I.

I’ve listed that tag in three other groups too and those were visible to everyone. The tag was hided from ordinary users when I cleaned it away from those other groups, but finding those ”overlapping” tag groups needed too much manual labour :woozy_face:

So, is there an easy way to find out in what groups a tag is added?

SQL of course, but I don’t speak it. And when I asked advise from chatbot I wasn’t specific enough, I reckon.

I think it tells you on the tag page using the tag wrench(/info button, if a non-staff user):

Oh for are f-words allowed here sake — how clueless a man can be :man_facepalming: I should knew that, but when I was on tag-page I never ever thought that road. A good example of limited thinking.

Well, that’s enough self-punishment for today :winking_face_with_tongue:

But… you can SQL and I bet you can talk to AI better than me. Do we have ability to ask that from the database? And that is pure curiosity, not a need anymore.

A query that lists tags and has a column of all their associated tag groups?

That should be possible with something like this:

SELECT 
    t.name AS "Tag",
    STRING_AGG(tg.name, ', ' ORDER BY tg.name) AS "Tag Groups"
FROM tags t
  JOIN tag_group_memberships tgm ON tgm.tag_id = t.id
  JOIN tag_groups tg ON tg.id = tgm.tag_group_id
GROUP BY t.name

That’s good starting point. Thanks!