在数据资源管理器中测试徽章查询时遇到问题

我是否能够在数据浏览器中运行任何徽章查询?

我想以“赞赏”为起点创建一个自定义徽章查询。我在数据浏览器中输入了“赞赏”查询:

SELECT p.user_id, current_timestamp AS granted_at
FROM posts AS p
WHERE p.like_count >= 1
    AND (:backfill OR p.user_id IN (:user_ids))
GROUP BY p.user_id
HAVING count(*) > 20

这导致了一个错误:

缺少 :backfill 的值

我大致理解“:”代表“绑定变量”,可以提高效率。我尝试移除了关于 backfill 的部分,但这又导致了另一个错误。

You will need to leave out the AND (:backfill OR p.user_id IN (:user_ids)) condition to run the query in the Data Explorer. :backfill and :user_ids both expect parameters to be passed to them.

Thanks, it seems to work fine without the AND clause. Can you tell me what the clause does (assuming it gets the parameters passed in), so I can decide whether to keep it?

If your badge is triggered by a user acting on a post, then you need to include this condition. The best description I’ve seen of how the :backfill and :user_ids parameters are used in badge queries is in the ‘Triggered badges have 2 extra constraints’ section of Create Triggered Custom Badge Queries.