psql feature request: --list-conninfo (dump the config info psql would use to connect)

Поиск
Список
Период
Сортировка
От David Johnston
Тема psql feature request: --list-conninfo (dump the config info psql would use to connect)
Дата
Msg-id CAKFQuwbG0CWv9Sq-aHShjWUHqy4P0vmH1mLa_7Xk4eBXz8bMSA@mail.gmail.com
обсуждение исходный текст
Список pgsql-general
Hi!

When psql (libpq) connects it uses a combination of defaults, environment variables, command line arguments, and possibly a pg_service file to figure out where it is going to connect, and how.

Specifying the option "--list-conninfo" as an option would cause psql to simply output all of the valid "conninfo" parameters and their current value.  It could also indicate whether a matching .pgpass entry was found.  By default it would not return the open connection - only dump the data.  However, when the "list-conninfo-prompt" option is provided psql would finish the display with a prompt -:"do you wish to connect to this database?".  Ideally an option of the form list-conninfo-fields='dbname,username,host,port' could be used to limit the displayed fields - especially useful with the prompt option so that the user does not get a screen full of data to skim.  A default config could be designed and made available while in prompt mode (non-prompt mode would list everything) and the -fields option would simply provide an override.

I see a use for this in semi-automatic scripts where you wish to add a measure of safety by allowing the user to at least review the connection setup once in the script before using the same connection string on subsequent attempts without prompting.  It would also make a useful debugging tool.

The interaction of this and various authentication mechanisms would be worth exploring in detail - even if it takes an actual connection attempt to work the details out.

While outside the scope of PostgreSQL itself the interaction with tools like pgPool and pgBouncer would be worthwhile - i.e., the ability to pass-through what your intermediary is going to be using to connect.

My goal in posting this is to get a reaction and hopefully, if favorable, get this added to the Wiki ToDo area.  Its not something I have the ability to code or desire to directly fund but it does seem like a feature that would contribute to new user friendliness and ease-of-use.

Thanks!

David J.

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

Предыдущее
От: Lacey Powers
Дата:
Сообщение: Re: 9.3.5 failing to compile with dtrace on FreeBSD 10.1
Следующее
От: Cory Zue
Дата:
Сообщение: help troubleshooting invalid page header error