데이터 탐색기가 맨 ID를 사용 가능한 링크로 변환할 때 수행하는 user_id 스타일의 마법 같은 것과 관련이 있는 것 같습니다. 리포트를 그대로 실행하면 여러분이 보고 계신 것과 동일한 오류가 발생하지만, SELECT에서 t.user_id와 t.last_post_user_id를 모두 제거하면 정상적으로 작동합니다.
해당 필드를 일반 사용자 이름으로 변환하면 자동화를 통해 정상적으로 작동하는 것 같습니다:
WITH
ua AS (
SELECT target_topic_id, COUNT(id) FROM user_actions
WHERE action_type = 15
GROUP BY target_topic_id
)
SELECT
t.id,
t.title,
t.created_at,
t.last_posted_at,
t.views,
t.posts_count,
us.username,
u2.username
FROM topics t
INNER JOIN users us ON us.id = t.user_id
LEFT JOIN ua ON ua.target_topic_id = t.id
JOIN users u2 ON u2.id = t.last_post_user_id
WHERE t.deleted_at IS NULL
AND t.closed = false
AND t.archived = false
AND t.visible = true
AND ua.target_topic_id IS NULL
AND us.username_lower != 'system'
AND t.created_at > now() - INTERVAL '7' DAY
ORDER BY created_at DESC
다만, 더 전문적인 분에게 연락하여 자세히 살펴봐 달라고 요청했습니다.
![]()
별개로, 여러분의 쿼리가 원하는 대로 작동하는지 확신이 서지 않습니다. 결과에 개인 메시지(PM)가 많이 표시되고 있는데, ‘Solution’(해결책) 관련 설정과 어떤 연관이 있는 건가요?