Re: Server name in psql prompt - Mailing list pgsql-general

From Greg Sabino Mullane
Subject Re: Server name in psql prompt
Date
Msg-id 7dcb7c60a915c11a813d47c0560c808b@biglumber.com
Whole thread Raw
In response to Server name in psql prompt  (Mark Morgan Lloyd <markMLl.pgsql-general@telemetry.co.uk>)
List 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 by date:

Previous
From: Tom Lane
Date:
Subject: Re: check the execution status of stored procedure
Next
From: Tom Lane
Date:
Subject: Re: pg.dropped