Bill McGonigle <mcgonigle@medicalmedia.com> writes:
> Under what circumstances might pg_dumpall store several copies of the
> database? When I restore the database with psql < dumpfile I see 4-5
> occurances of each database. This is on 7.1.3.
pg_dumpall gets the list of databases to store using a query along the
lines of
SELECT ... FROM pg_database d LEFT JOIN pg_shadow u ON (datdba = usesysid)
If you happen to have multiple entries in pg_shadow with the same
usesysid, then the SELECT will generate multiple rows for the matching
databases.
7.2 has a unique index on pg_shadow.usesysid, so hopefully this failure
mode is a thing of the past now. In the meantime, get rid of the extra
pg_shadow entries and dump again.
regards, tom lane