Postgresql – psql: warning: extra command-line argument “postgres.dolphin.com” ignored

linuxpg-dumppostgresql

when I using this command to copy table video from database dolphin to database acientbay in Fedora 32, shows error like this:

/usr/share/postgresql-13/bin/pg_dump -v -t video -h postgres.dolphin.com -U postgres -p 5432 -d dolphin | /usr/share/postgresql-13/bin/psql -v -h postgres.dolphin.com -U postgres -p 5432 -d acientbay

where I am going wrong with my command? what should I do to fix it? The database was in the remote datacenter.

Best Answer

In psql, the -v option takes an argument. It does not mean verbose, like it does for pg_dump. So the -v 'eats' the -h, considering an argument to -v. That leaves postgres.dolphin.com as being just a bare argument not belonging to any option. Normally that would be interpreted as the database name or as the user name, but since you already have -d something and -U something, that doesn't work. So it doesn't what to do with this bare argument, and complains.