안녕하세요. UNLISTED 게시글에 답글을 달았을 때 배지를 부여하는 배지 쿼리를 작성하려고 합니다.
불행히도 일반적인 쿼리는 어째서인지 “UNLISTED” 게시글을 무시해서 배지를 부여하지 않는 것 같습니다.
아래는 해당 쿼리입니다. 위 내용과 동일합니다:
SELECT
DISTINCT ON (p.user_id)
p.user_id, p.id post_id, p.created_at granted_at
FROM badge_posts p
WHERE p.topic_id = 81 AND -- 81은 제가 원하는 토픽입니다
(:backfill OR p.id IN (:post_ids) )
그리고 다음과 같은 오류가 발생합니다:
No Badges to be assigned.
Unique (cost=25.87..25.88 rows=2 width=16)
-> Sort (cost=25.87..25.87 rows=2 width=16)
Sort Key: p.user_id
-> Hash Join (cost=6.73..25.86 rows=2 width=16)
Hash Cond: (t.category_id = c.id)
-> Nested Loop (cost=4.32..23.44 rows=4 width=20)
-> Index Scan using topics_pkey on topics t (cost=0.14..8.16 rows=1 width=8)
Index Cond: (id = 81)
Filter: ((deleted_at IS NULL) AND visible)
-> Bitmap Heap Scan on posts p (cost=4.18..15.24 rows=4 width=20)
Recheck Cond: (topic_id = 81)
Filter: ((deleted_at IS NULL) AND (post_type = ANY ('{1,2,3}'::integer[])))
-> Bitmap Index Scan on index_posts_on_topic_id_and_sort_order (cost=0.00..4.17 rows=4 width=0)
Index Cond: (topic_id = 81)
-> Hash (cost=2.21..2.21 rows=16 width=4)
-> Seq Scan on categories c (cost=0.00..2.21 rows=16 width=4)
Filter: (allow_badges AND (NOT read_restricted))
Unlisted 게시글을 무시하지 않도록 쿼리를 수정하는 방법은 무엇인가요?
시간 내어 답변해 주셔서 감사합니다.