Sv: Re: How to get shorter SERVER_VERSION in psql-prompt? - Mailing list pgsql-general

From Andreas Joseph Krogh
Subject Sv: Re: How to get shorter SERVER_VERSION in psql-prompt?
Date
Msg-id VisenaEmail.46.c1d7041585adc860.165a15e08a9@tc7-visena
Whole thread Raw
In response to Re: How to get shorter SERVER_VERSION in psql-prompt?  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: Sv: Re: How to get shorter SERVER_VERSION in psql-prompt?
List pgsql-general
På mandag 03. september 2018 kl. 23:03:10, skrev Alvaro Herrera <alvherre@2ndquadrant.com>:
On 2018-Sep-03, Andreas Joseph Krogh wrote:

> Hi all, I'm using the Ubuntu-packages and have this in my .psqlrc:
>  
> \set PROMPT1 '%[%033[35m%]%n@%m:%>%[%033[0m%] %:server_version:
> %[%033[32m%]%/%[%033[0m%]%R%# '
>   
> 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"?

Well, where does that server_version come from?  Try adding this
somewhere to .psqlrc:

select setting as server_version from pg_settings where name = 'server_version' \gset
 
select setting as server_version from pg_settings where name = 'server_version';
┌──────────────────────────────────┐
│          server_version          │
├──────────────────────────────────┤
│ 10.5 (Ubuntu 10.5-1.pgdg18.04+1) │
└──────────────────────────────────┘
(1 row)

 
I use packages from http://apt.postgresql.org/pub/repos/apt/
 
--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
 
Attachment

pgsql-general by date:

Previous
From: Christoph Moench-Tegeder
Date:
Subject: Re: How to get shorter SERVER_VERSION in psql-prompt?
Next
From: Andreas Joseph Krogh
Date:
Subject: Sv: Re: How to get shorter SERVER_VERSION in psql-prompt?