Quale sarebbe una query SQL per estrarre tutti i post con checkbox non selezionate in una particolare categoria, inclusi gli estratti (cioè il paragrafo che contiene quella checkbox)?
-- [params]
-- int_list :categories
SELECT p.id post_id,
t.id topic_id,
c.id category_id,
(regexp_matches(p.raw, '\\[\s\]\s*[^]\r\n]+', 'g'))[1] AS html$excerpt
FROM posts p
JOIN topics t ON p.topic_id = t.id
JOIN categories c ON t.category_id = c.id
WHERE p.raw ~ '\[\s\]\s*[^]\r\n]+'
AND c.id IN (:categories)