Re: Optional postgres database not so optional in 8.1

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paesold <mpaesold(at)gmx(dot)at>, "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>, John Hansen <john(at)geeknet(dot)com(dot)au>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Optional postgres database not so optional in 8.1
Date: 2005-11-17 18:55:27
Message-ID: 437CD21F.5090400@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Tom Lane wrote:

>"Michael Paesold" <mpaesold(at)gmx(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2005-11-17 18:56:21 Re: [HACKERS] ERROR: could not read block
Previous Message Tom Lane 2005-11-17 18:29:29 Re: Optional postgres database not so optional in 8.1