Naim Salameh
Naim Salameh

Reputation: 417

pg_dumpall missing = in connection string

I'm trying to run pg_dumpall on an AWS RDS instance (postgres). I tried to connect to the db by using psql:

psql -d $DBNAME -h $HOST -p $PORT -U $USERNAME

I'm of course prompt for password and everything works fine - I'm able to connect.

I then tried:

pg_dumpall.exe -d $DBNAME -h $HOST -p $PORT -U $USERNAME -f testme.sql

I get the following error:

pg_dumpall: missing "=" after "billingdb" in connection info string

I'm using git bash as my terminal, I'm on windows 10, my psql version is 9.6.4 The connection itself is done via port forwarding so my host is localhost and some port that the port_forwarding action provide if that matters. According to the documentation I'm doing everything right so I'm out of ideas.

Upvotes: 9

Views: 12104

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246033

The option -d means something else in psql and in pg_dumpall. The pg_dumpall documentation says:

-d connstr
--dbname=connstr

Specifies parameters used to connect to the server, as a connection string. See Section 32.1.1 for more information.

The option is called --dbname for consistency with other client applications, but because pg_dumpall needs to connect to many databases, database name in the connection string will be ignored. Use -l option to specify the name of the database used to dump global objects and to discover what other databases should be dumped.

My advice is to just omit that option, then the database postgres is used as it should.

Upvotes: 14

Related Questions