Home > other >  pg_dump using connection string failed
pg_dump using connection string failed

Time:10-22

On my mac OS machine, in bash, pg_dump using connection string is working correctly.

pg_dump postgresql://<db_username>:<db_password>@<host>:5432/<db_name> --file=/Users/dump1234.tar --encoding=utf8 --format=t

where <db_password> ends with '@' character and has few special characters.

However, on my Windows 10 machine, in bash, giving an error with the same connection string.

for example, pg_dump postgresql://thilllon:l2k2lllk2j3!@!#$@!!!@@myproject.postgres.database.azure.com:5432/project1 --file=C:\\.backup\\tmp.tar --format=t

Already read, not helpful

CodePudding user response:

The syntax is documented at Connection Strings.

The @ character needs to be replaced in the password by @.

Also bash will interpret an unquoted # as the start of a comment and an unquoted ! as an event designator. The simplest way to avoid these interpretations is to put the whole URI inside single quotes:

pg_dump 'postgresql://thilllon:l2k2lllk2j3!@!#$@!!!@@myproject.postgres.database.azure.com:5432/project1'
  • Related