I noticed a misleading error message recently while using createdb. Try: test=# CREATE ROLE dummy NOLOGIN;
Now, attempt to use createdb as that role. Here's 9.1.1: $ createdb -Udummy testdb createdb: could not connect to database postgres: FATAL: role "dummy" is not permitted to log in And here is git head: $ createdb -Udummy testdb createdb: could not connect to databases "postgres" or "template1" Please specify an alternative maintenance database. Try "createdb --help" for more information. Although I guess you could argue the latter message is technically correct, since "could not connect" is true, the first error message seems much more helpful. Plus, "Please specify an alternative maintenance database" is a rather misleading hint to be giving in this situation. This seems to be happening because connectMaintenanceDatabase() is passing fail_ok = true to connectDatabase(), which in turn just returns NULL and doesn't print a PQerrorMessage() for the failed conn. So connectMaintenanceDatabase() has no idea why the connection really failed. A simple fix would be just to pass fail_ok = false for the last connectDatabase() call inside connectMaintenanceDatabase(), and give up on trying to tack on a likely-misleading hint about the maintenance database. Patch attached. This leads to: $ createdb -Udummy testdb createdb: could not connect to database template1: FATAL: role "dummy" is not permitted to log in which is almost the same as the 9.1.1 output, with the exception that "template1" is mentioned by default instead of the "postgres" database. Josh
connectMDB_error.diff
Description: Binary data
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers