Yeah, Oracle nested tables are useful. In the past, I've used them
(along with Oracle's owa_pattern regexp library) to create kludgy but
occasionally useful little PL/SQL functions like "plsql_to_tcl_list".
(It's not terribly pretty, but if you're curious you can take a look
old PL/SQL code
doing that sort of thing - it's in the plsql-list*.sql files.)
I don't know if anything similar exists for Postgres though.
Besides, what's wrong with (carefully) implementing it the way you
already did, with string substitution? There's presumably some
performance hit, but I'd bet there's a performance hit from invoking
PL/SQL nested tables in Oracle, too.