Hey @Moin first I want to thank you for your help, this sql/queries usage is other approach to solve an issue in Discourse that I never tried before.
Finally I could run your query, with the help of AI I modified your query to pass the parameters hard-coded in the query directly to Postgres using pgAdmin4. I found that my problematic tag was duplicated in two tag-groups and both tag-groups have different restrictions settings so it could be one reason for conflict, so now I am keeping the tag in one tag-group. But the problem remains, despite that change regular users TL0 and TL1 canât see the tag even when those groups are authorized to use the tags.
I have crated several queries gathering more information. I coud identify two others tags that belongs to the same tag-group and in UI look like they have the same settings but with the queires I could identify one difference, in the Database in the tags table the pm_topic_count field of my TAG1 has the number 1 value and the other two tags have 0 (zero).
```
tag_name public_topic_count pm_topic_count
TAG1 0 1
TAG2 0 0
TAG3 0 0
```
Researching what I understand is that it is like a quick counter to know how many times the tag has been used, but it does not make sense because I know it is used more than one time for moderators. I asked to AI and it says:
pm_topic_count:
This one is critical. For TAG1 you found pm_topic_count = 1, while TAG2 and TAG3 = 0.
-
That means TAG1 has at least one private message topic using it.
-
When a tag is primarily used in PMs, Discourse can treat it as âhiddenâ or ânon-discoverableâ in category composer UIs for regular users. This aligns exactly with your problem: TAG1 may not appear as available for new topics.
I created a query to list all private messages topics for identification, then I went to my forum and with Admin permissions got the private-message topics using the TAG1 and removed the TAG. Now the issue is solved and regular users can use the TAG again⌠I hope it continue working as expected (finger crossed).
BTW â After I removed the TAG1 from the private-message topic I checked the database and the field pm_topic_count = 0 for TAG1.