Query
select u.id, u.name,
-- every post, as an array
array(
select p from (
select id, title from posts where user_id = u.id order by id
) p
) as posts,
-- the latest post, or null
(
select p from (
select id, title from posts
where user_id = u.id
order by published_at desc nulls last
limit 1
) p
) as latest_post
from users u
where u.id = :id::int