それぞれの言語にLibpqバインディングを使用する場合、そのドキュメントによると、URIは次のように形成されます。
postgresql://[user[:password]@][netloc][:port][/dbname][?param1=value1&...]
これが同じドキュメントの例です
postgresql://
postgresql://localhost
postgresql://localhost:5432
postgresql://localhost/mydb
postgresql://example@sqldat.com
postgresql://user:example@sqldat.com
postgresql://example@sqldat.com/otherdb?connect_timeout=10&application_name=myapp
postgresql://localhost/mydb?user=other&password=secret