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
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.
Oh for are f-words allowed here sake — how clueless a man can be 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
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