~Исходники утверждают, что комментариев в теме должно быть больше чёртовой дюжины.~
select topics.postdate, topics.id as msgid, topics.userid, topics.title,
topics.groupid as guid, topics.url, topics.linktext, topics.ua_id,
urlname, section, topics.sticky, topics.postip,
COALESCE(commitdate, topics.postdate)<(CURRENT_TIMESTAMP-sections.expire) as expired, topics.deleted, lastmod, commitby,
commitdate, topics.stat1, postscore, topics.moderate, notop,
topics.resolved, minor, draft, allow_anonymous, topics.reactions
from topics join groups ON (groups.id=topics.groupid) join sections on (sections.id=groups.section)
where topics.id in (
select topic from comments join users on comments.userid=users.id join topics on (comments.topic=topics.id)
where comments.postdate>CURRENT_TIMESTAMP-'5 hour'::interval and score>=100 and topics.groupid!=4068
and topics.id not in (select topic_id from telegram_posts) and not topics.deleted AND not comments.deleted
and not notop and not draft and topics.postscore is distinct from ${TopicPermissionService.POSTSCORE_HIDE_COMMENTS}
group by topic
having count (distinct comments.userid)>=14
order by count(distinct comments.userid) desc
limit 1)