-- Check table structure SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'posts' ORDER BY ordinal_position; -- Show a sample post with its categories SELECT bp.title, array_agg(c.name) as categories FROM posts bp JOIN post_categories bpc ON bpc.post_id = bp.id JOIN categories c ON c.id = bpc.category_id GROUP BY bp.id, bp.title LIMIT 1;