db_uri - username contains @ (ie email address) fails
Hi Is there a way to escape @ in connection info (db-uri) ?
Using email addresses as a username (@) results in a postnumber error:
db-uri = "postgres://[email protected]:[email protected]:7000/common"
{"details":"invalid port number: \"[email protected]@cluster.stil.dk:7000\"\n","code":"","message":"Database connection error"}
I have tried to escape @ and using " and ' and \ - but it seems not to work. Is it possible to use @ in the db-uri?
I can connect to the database using:
psql -h cluster.stil.dk -d common -U "[email protected]" -p 7000
If I replace [email protected] with a user not having @, it is working.
Thanks for the product :-)
Best
The postgres connection string docs say this:
The connection URI needs to be encoded with percent-encoding if it includes symbols with special meaning in any of its parts.
I suggest you try
db-uri = "postgres://user%40email.com:[email protected]:7000/common"
Alternatively, you could try to do this:
Values that would normally appear in the hierarchical part of the URI can alternatively be given as named parameters.
So something like this:
db-uri = "postgres://cluster.stil.dk:7000/[email protected]&password=secret"