On 21st of November Robert Haas committed new patch, which adds new function: Add new SQL function, format(text). Currently, three conversion format specifiers are supported: %s for a string, %L for an SQL literal, and %I for an SQL identifier. The latter two ...

Having new VARIADIC functions, I decided it would be cool to be able to write sprintf() function. Basically the idea is simple, plperl function, which takes "format", and list of arguments and returns generated output.