Also I have issue with this command:
pg_dump -d 'postgresql://postgres@host.internal?sslmode=require' --create --clean --if-exists mydb
pg_dump: error: too many command-line arguments (first is "userdb")
pg_dump: hint: Try "pg_dump --help" for more information.
I want to connect to 'postgres' database and dump 'mydb', because database was turned to readonly mode and does not accept connections:
pg_dump -d 'postgresql://postgres@host.internal/userdb?sslmode=require' --create --clean --if-exists
pg_dump: error: connection to server at "host.internal" (172.31.x.x), port 5432 failed: FATAL: database "mydb" is not currently accepting connections
Please note, this is not the question and I am not looking for help. Here I want to share my use case which is not covered in doc. Eg `-d XXX` option with `dbname` parameter.