stdlib.RegisterConnConfig allows you to use a *pgx.ConnConfig object to instantiate a sql.DB object
In our use case we were not writing the certificates to a file and were just adding them to the *pgx.ConnConfig object which is not possible with a connection string.
stdlib.RegisterConnConfig only updates the stdlib.GetDefaultDriver()
nrpgx does not wrap the stdlib.GetDefaultDriver() but rather an empty &stdlib.Driver{}, if it wrapped the default driver than all of the advanced pgx configuration options can be used
Desired Behaviour
Be able to use the strings returned from stdlib.RegisterConnConfig when opening the nrpgx driver
Summary
stdlib.RegisterConnConfig allows you to use a *pgx.ConnConfig object to instantiate a sql.DB object
In our use case we were not writing the certificates to a file and were just adding them to the *pgx.ConnConfig object which is not possible with a connection string.
stdlib.RegisterConnConfig only updates the stdlib.GetDefaultDriver()
nrpgx does not wrap the stdlib.GetDefaultDriver() but rather an empty &stdlib.Driver{}, if it wrapped the default driver than all of the advanced pgx configuration options can be used
Desired Behaviour
Be able to use the strings returned from stdlib.RegisterConnConfig when opening the nrpgx driver
Possible Solution
https://github.com/newrelic/go-agent/blob/master/v3/integrations/nrpgx/nrpgx.go#L88 When I replaced the above line with
sql.Register("nrpgx", newrelic.InstrumentSQLDriver(stdlib.GetDefaultDriver(), baseBuilder))
I was able to instrument new relic and instantiate my db with this line
db, err := sql.Open("nrpgx", stdlib.RegisterConnConfig(pgConfig.ConnConfig))
Additional context
If this was ported from https://github.com/newrelic/go-agent/tree/master/v3/integrations/nrpq lib/pq did not have these configuration options so this may have been over looked