Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pg_dump: too many command line arguments

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

like image 745
Bhargav Gor Avatar asked Aug 08 '12 13:08

Bhargav Gor


People also ask

Is pg_dump slow?

It seams that the pg_dump compression is rather slow if data is already compressed as it is with image data in a bytea format. And it is better to compress outside of pg_dump (-Z0). The time has dropped from ~70 minutes to ~5 minutes.

Is pg_dump consistent?

pg_dump is a utility for backing up a PostgreSQL database. 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).

What is pg_dump and Pg_restore?

The pg_dump and pg_restore command line tools are used to export and import PostgreSQL databases. They create PostgreSQL backups and migrate PostgreSQL databases between servers.


2 Answers

Looks like its the -W option. There is no value to go with that option.

-W, --password           force password prompt (should happen automatically) 

If you want to run the command without typing is a password, use a .pgpass file. http://www.postgresql.org/docs/9.1/static/libpq-pgpass.html

like image 153
Jim Avatar answered Sep 28 '22 06:09

Jim


For posterity, note that pg_dump and pg_restore (and many other commands) cannot process long hyphens that word processors create. If you are cut-pasting command lines from a word processor, be sure it hasn't converted your hyphens to something else in editing. Else you will get command lines that look correct but hopelessly confuse the argument parsers in these tools.

like image 33
johnkaplantech Avatar answered Sep 28 '22 07:09

johnkaplantech