Re: How to get shorter SERVER_VERSION in psql-prompt?

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Andreas Joseph Krogh <andreas(at)visena(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: How to get shorter SERVER_VERSION in psql-prompt?
Date: 2018-09-03 21:03:10
Message-ID: 20180903210310.hz67nutccucwhzxa@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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(at)%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

--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christoph Moench-Tegeder 2018-09-03 21:34:48 Re: How to get shorter SERVER_VERSION in psql-prompt?
Previous Message Andreas Joseph Krogh 2018-09-03 20:52:31 How to get shorter SERVER_VERSION in psql-prompt?