Search Postgresql Archives

Re: Server name in psql prompt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----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@xxxxxxxxxxxx
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-----



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux