Re: Server name in psql prompt

Поиск
Список
Период
Сортировка
От Greg Sabino Mullane
Тема Re: Server name in psql prompt
Дата
Msg-id 7dcb7c60a915c11a813d47c0560c808b@biglumber.com
обсуждение исходный текст
Ответ на Server name in psql prompt  (Mark Morgan Lloyd <markMLl.pgsql-general@telemetry.co.uk>)
Список pgsql-general
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160


> Is there any way of getting psql to display the name of the
> currently-connected server in its prompt, and perhaps a custom string
> identifying e.g. a disc set, without having to create a psqlrc file on
> every client system that's got a precompiled psql installed?

Sure, use backticks to get what you want into there. For example,
here's one of my common prompts:

\set PROMPT1 '%n@%`hostname`:%>%R%#%x%x%x '

I once had a client that needed something more than that, so I
wrote a quick shell script that outputted the info on a single
line and then called the script inside the backticks.

- --
Greg Sabino Mullane greg@turnstep.com
End Point Corporation http://www.endpoint.com/
PGP Key: 0x14964AC8 201001080924
http://biglumber.com/x/web?pk=2529DF6AB8F79407E94445B4BC9B906714964AC8
-----BEGIN PGP SIGNATURE-----

iEYEAREDAAYFAktHQIcACgkQvJuQZxSWSsgo6QCg5/4Rtx5Jnoso+i9P6+cph+1e
do8AoIVqlXg8u8Eb8NtPWm+Y2y+sYyfB
=gmZS
-----END PGP SIGNATURE-----



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: check the execution status of stored procedure
Следующее
От: Tom Lane
Дата:
Сообщение: Re: pg.dropped