Would it be unreasonable to make datname a primary key in pg_database ?
nm
> > it turns out there was multiple template1's in the pg_database table:
>
> I have no idea how this happens, but when it does, things are bad.
>
> I have improved the error message in pg_dump, saying:
>
> pg_dump: couldn't find the template1 database.
> Check the table pg_database for a problem.
> There should be exactly one 'template1' entry.