From: | Andreas Joseph Krogh <andreas(at)visena(dot)com> |
---|---|
To: | Christoph Moench-Tegeder <cmt(at)burggraben(dot)net> |
Cc: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Sv: Re: How to get shorter SERVER_VERSION in psql-prompt? |
Date: | 2018-09-03 21:41:17 |
Message-ID: | VisenaEmail.47.afda8e357a746e7.165a161d3d5@tc7-visena |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
På mandag 03. september 2018 kl. 23:34:48, skrev Christoph Moench-Tegeder <
cmt(at)burggraben(dot)net <mailto:cmt(at)burggraben(dot)net>>:
## Andreas Joseph Krogh (andreas(at)visena(dot)com):
> This results in this verver_version:
> 10.5 (Ubuntu 10.5-1.pgdg18.04+1)
>
> Is it possible to adjust this somehow so it outputs only "10.5"?
On Debian/Ubuntu, all version strings are somewhat extended.
Luckily, with the power of SQL we're not completely helpless, so try
this in your .psqlrc (somewhat simpler than your prompt, but you
get the idea):
select substring(current_setting('server_version') from '#"[^ ]+#"( +%)?' for
'#') as short_server_ver\gset
\set PROMPT1 '%/ %:short_server_ver: %R%# '
Yes, that works across \c.
Nice, thanks!
-- Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andreas(at)visena(dot)com <mailto:andreas(at)visena(dot)com>
www.visena.com <https://www.visena.com>
<https://www.visena.com>
From | Date | Subject | |
---|---|---|---|
Next Message | Alvaro Herrera | 2018-09-03 21:42:01 | Re: Sv: Re: How to get shorter SERVER_VERSION in psql-prompt? |
Previous Message | Andreas Joseph Krogh | 2018-09-03 21:39:36 | Sv: Re: How to get shorter SERVER_VERSION in psql-prompt? |