I have a table in PostgreSQL that contains:
id name arrayofparents 1 First 2 Second {1} 3 Second_Sec {1,2} 4 Third {1,2,3} 5
If you only want direct parents (not grandparents) then something like this should work:
SELECT c.id, c.name, string_agg(p.name, '->') AS parentnames FROM yourtable AS c LEFT JOIN yourtable AS p ON p.id = ANY c.parents GROUP BY c.id, c.name