Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pg_dumpall missing = in connection string

Tags:

postgresql

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.

like image 831
Naim Salameh Avatar asked Aug 28 '17 16:08

Naim Salameh


People also ask

What is Pg_dumpall in PostgreSQL?

pg_dumpall is a utility for writing out (“dumping”) all PostgreSQL databases of a cluster into one script file. The script file contains SQL commands that can be used as input to psql to restore the databases. It does this by calling pg_dump for each database in the cluster.

How do I back up just the roles of users in PostgreSQL?

You can use pg_dumpall for that with the --globals-only option: pg_dumpall --globals-only --file=all_roles_and_users.

Does pg_dump include users?

It makes consistent backups even if the database is being used concurrently. pg_dump does not block other users accessing the database (readers or writers).


1 Answers

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.

like image 124
Laurenz Albe Avatar answered Oct 03 '22 19:10

Laurenz Albe