Unnest the array then you can join:
select ph.id, ph.name, pe.*
from photos ph
left join jsonb_array_elements(ph.persons) as p(pid) on true
left join person pe on pe.id = p.pid::int
The first left join expands all array elements to rows. A left join is required, otherwise photos with an empty persons
array would not show up. Then you can join against the person table.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…