The custom field it works now ( I tried to implement this example ) but no matter what trust level I’ll type, the number of potential users stays the same:
SELECT cf.user_id user_id, cf.updated_at granted_at
FROM user_custom_fields cf
INNER JOIN user_fields uf
ON uf.id = (0 || regexp_replace(cf.name, 'user_field_', ''))::integer
AND uf.name = 'Gender'
WHERE cf.value = 'Woman'
AND EXISTS (
SELECT u.id user_id, current_timestamp granted_at FROM users u
WHERE trust_level >= 0 AND (
:backfill OR u.id IN (:user_ids)
)
)
Any thoughts?