On Fri, 2009-08-28 at 11:52 -0400, Tom Lane wrote:
> I've thought of an easier way to handle this: if the given database name
> is invalid, connect to database "postgres" instead, and perform
> authentication using normal access to the pg_auth catalogs. If
> authentication succeeds, *then* throw the error about nonexistent
> database. If "postgres" is not there, we'd still expose existence
> of the original database name early, but how many installations don't
> have that?
I run into it all the time. People drop the postgres database as not
needed.
> (I thought about trying template1 and/or template0 as
> fallbacks, but that's probably not a good thing. Backends that are
> waiting on a client for authentication would pose a DOS problem for
> sessions trying to do CREATE DATABASE, if they're connected to those.)
What if there was a silent database, say pg_authdb. That isn't even
visible under normal circumstances (need to be in single user mode)?
Alternatively just make it so the postgres database can't be dropped.
ERROR: The database postgres is a system database. It can not be
dropped.
Joshua D. Drake
--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering