Badge SQL triggered on post content

I’m trying to award a badge depending on the content of a post.

For example, If I type ‘Give Me A Badge’ i’m awarded the ‘Demanding’ badge.

My SQL is as follows:

SELECT p.user_id, p.id post_id, p.updated_at granted_at
FROM badge_posts p
WHERE p.raw LIKE '%Give Me A Badge%' 
AND (:backfill OR p.id IN (:post_ids) )

With ‘Query targets posts’ and ‘When a user creates or edits a post’.

It’s not, however being triggered. The ’ Badge Query Preview’ shows hits for awards, but the site doesn’t appear to be awarding them.

Help and advice welcome, please.

(post deleted by author)