Read the parameter metadata upfront, then look it up as needed.  This is required for PostgreSQL because some operations mutate the parameter metadata result post-facto and creates havoc generally speaking.