Tom Lane wrote:
>"Michael Paesold" <mpaesold@gmx.at> writes:
>
>
>>It's the '-l' option (list all databases) that does not honor the database
>>given on the command line.
>>This does not work, if the postgres database is dropped in 8.1:
>>
>>
>
>
>
>>psql -l template1
>>
>>
>
>It does seem a bit inconsistent that psql wouldn't connect to the
>specified database in order to do -l, if one is specified.
>Anyone want to look and see if it's easy to change?
>
>
The relevant code in startup.c reads:
pset.db = PQsetdbLogin(options.host, options.port, NULL, NULL, options.action == ACT_LIST_DB ?
"postgres": options.dbname, username, password);
I think we could probably just change the expression to something like:
options.action == ACT_LIST_DB && options.dbname == NULL ?
"postgres" : options.dbname
cheers
andrew