pg_dump: too many command line arguments

Viewed 51489

what is wrong with this command:

pg_dump -U postgres -W admin --disable-triggers -a -t employees -f D:\ddd.txt postgres

This is giving error of too many command-line arguments

8 Answers

Instead of passing password with -W flag start with setting temporary variable for postgres:

PGPASSWORD="mypass" pg_dump -U postgres--disable-triggers -a -t employees -f D:\ddd.txt postgres

Another option is to add ~/.pgpass file with content like this:

hostname:port:database:username:password

read more here

2021-11-30, pg v12, windows 10

pg_dump -U postgres -W -F t postgres > C:\myfolder\pg.tar

-U "postgres" as username,

-W to prompt for psd,

-F t means format is .tar,

> C:\myfolder\pg.tar is the destination path and filename

Related