I long while back I had a similar issue and drafted a patch (working code / build but no test) to add some libpq parameter support. It was for pg_service, which can point to a connection config file and leverages libpq's ability to read that for any / all possible parameters.
At the time, Heikki was doing the only commits and suggested a non file based approach where we pass in to libpq any provided parameters not currently explicitly handled. This has the advantage over pg_service of not having to supply a service config file with the application. I wasn't sure how to do that though (rudimentary C skills...) and had a workaround for the motivating problem so I left it alone.
What would be the current preferred approach? E.g. (or some combination of)
1. write boilerplate-ish code to explicitly handle all current libpq parameters, or
2. write the above pass-all-in feature, or
3. use pg_service.
I've attached my patch for 3, and could work on 1, but I'd need some pointers (ha) on doing 2.
Best regards,
Lindsay