Re: Optional postgres database not so optional in 8.1

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Optional postgres database not so optional in 8.1
Дата
Msg-id 437CD21F.5090400@dunslane.net
обсуждение исходный текст
Ответ на Re: Optional postgres database not so optional in 8.1  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Optional postgres database not so optional in 8.1  (Andrew Dunstan <andrew@dunslane.net>)
Список pgsql-hackers

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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Optional postgres database not so optional in 8.1
Следующее
От: "Magnus Hagander"
Дата:
Сообщение: Re: [ADMIN] ERROR: could not read block