Si utiliza el enlace Libpq para el idioma respectivo, de acuerdo con su documentación, el URI se forma de la siguiente manera:
postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]
Aquí hay ejemplos del mismo documento
postgresql://
postgresql://localhost
postgresql://localhost:5432
postgresql://localhost/mydb
postgresql://[email protected]
postgresql://user:[email protected]
postgresql://[email protected]/otherdb?connect_timeout=10&application_name=myapp
postgresql://localhost/mydb?user=other&password=secret