The approved way to do this is with format_type_be(), or format_type_with_typemod() if you want to include typmod info, which I think you probably do for the intended use-case.
regards, tom lane
Thanks Tom, I'll redo the patch using one of those, and get back to you guys.