Christopher Kings-Lynne <chriskl@familyhealth.com.au> writes:
>> Ooops :-( Seems like maybe we want it to try postgres and then fall
>> back to trying template1?
> Actually, also ONLY assume postgres is a special database if the backend
> is 8.1 or higher. We don't want to mess with poor people who have
> already created a database called 'postgres' in their installation of
> 7.4, say...
No, because it's special anyway where the dump will be reloaded. Keep
in mind that the design assumption for pg_dump(all) is always that the
destination database will be current release or higher; frequently the
dump file won't even be parseable by older servers.
The thing that makes this slightly painful is that we can't tell what
version we are dumping *from* until we've connected, and so we cannot
automagically "do the right thing" here. I don't really see any other
way to do it than the try-and-fallback approach.
regards, tom lane