1SELECT id, i.title AS item_title, t.tag_array
2FROM items i
3JOIN ( -- or LEFT JOIN ?
4 SELECT it.item_id AS id, array_agg(t.title) AS tag_array
5 FROM items_tags it
6 JOIN tags t ON t.id = it.tag_id
7 GROUP BY it.item_id
8 ) t USING (id);
9