Re: Server name in psql prompt
От | Mark Morgan Lloyd |
---|---|
Тема | Re: Server name in psql prompt |
Дата | |
Msg-id | hia2vq$a66$1@pye-srv-01.telemetry.co.uk обсуждение исходный текст |
Ответ на | Re: Server name in psql prompt (Mark Morgan Lloyd <markMLl.pgsql-general@telemetry.co.uk>) |
Список | pgsql-general |
Mark Morgan Lloyd wrote: > I thought earlier that I could use finger as a hack for querying the > server, i.e. I could put e.g. a disc set name in /home/postgres/.plan. > However I then realised that I'd need %M to be expanded before %`, so > that I could do something like > > \set PROMPT1 '`finger postgres@%M|filter`: %/%R%# ' > > where filter only returned the bit that was needed. I've not tried this > due to the ordering issue. I've just been playing with this. I can finger a fixed server for its "true name" using e.g. postgres: markMLl=> \set PROMPT1 '%`finger postgres@postgres|head -1|cut -d \[ -f 2|cut -d . -f 1`: %/%R%# ' postgres1: markMLl=> but if I try to replace the fixed server name in that \set PROMPT1 '%`finger postgres@%:HOST:|head... the nested variable doesn't get expanded. That's obviously useful if there's only one server or the servers are pooled since it means that the current disk set or whatever can be identified, but less so if there are multiple servers. -- Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
В списке pgsql-general по дате отправления: