pg_dumpall -h looks up database names locally.

Started by PostgreSQL Bugs Listover 25 years ago2 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

Scott Marlowe (smarlowe@ihs.com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
pg_dumpall -h looks up database names locally.

Long Description
pg_dumpall -h should dump all the databases on a remote box, but instead appears to be looking up the names of the databases to backup locally, then running the backup of the databases with the same name on the remote host. If both the local and remote machines have the same named databases, then pg_dumpall -h will work.

If the host machine has databases that aren't on the client machine, then those databases will not get backed up, with no error message or any kind.

If the client machine has databases that don't exist on the remote host, then pg_dumpall will fail with an error message that the databases that exist on the client do not exist on the remote host.

Sample Code
host machine has databases named test1 and test2. Client machine has databases named test1, test2, and test3.

client# >pg_dumpall -h remote_host >file.dmp
Connection to database 'test3' failed.
FATAL 1: Database "test3" does not exist in the system catalog.

This bug has been confirmed on two different sets of test machines, both built from source files, one set running 7.0.2 and one set running 7.0.3. They are setup to use "trust" mode authentication (i.e. no authentication at all) and all other operations occurr normally. pg_dump -h hostname databasename works fine across the network.

Luckily the fix is VERY easy, since pg_dumpall is a shell script.

All I had to do was add $1 $2 to each psql command like so:

psql -A -q -t template1

becomes

psql $1 $2 -A -q -t template1

And interestingly, since $1 and $2 are normally empty for local dumps, they don't interfere with those either.

No file was uploaded with this report

#2Peter Eisentraut
peter_e@gmx.net
In reply to: PostgreSQL Bugs List (#1)
Re: pg_dumpall -h looks up database names locally.

pg_dumpall -h looks up database names locally.

True. You will find this fixed in 7.1.

--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/