pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andreas Joseph Krogh <andreas@visena.com>
To: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Sv: Re: How to get shorter SERVER_VERSION in psql-prompt?
Date: Mon, 3 Sep 2018 23:39:36 +0200 (CEST)
Message-ID: <VisenaEmail.46.c1d7041585adc860.165a15e08a9@tc7-visena> (raw)
In-Reply-To: <20180903210310.hz67nutccucwhzxa@alvherre.pgsql>

På mandag 03. september 2018 kl. 23:03:10, skrev Alvaro Herrera <
alvherre@2ndquadrant.com <mailto: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
andreas@visena.com <mailto:andreas@visena.com>
www.visena.com <https://www.visena.com;
 <https://www.visena.com;


 

view thread (5+ messages)  latest in thread

Message-ID: <VisenaEmail.46.c1d7041585adc860.165a15e08a9@tc7-visena>
Permalink:  ../VisenaEmail.46.c1d7041585adc860.165a15e08a9@tc7-visena/
Also on:    postgresql.org/message-id/VisenaEmail.46.c1d7041585adc860.165a15e08a9@tc7-visena

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andreas@visena.com, alvherre@2ndquadrant.com
  Subject: Re: How to get shorter SERVER_VERSION in psql-prompt?
  In-Reply-To: <VisenaEmail.46.c1d7041585adc860.165a15e08a9@tc7-visena>
  References: <20180903210310.hz67nutccucwhzxa@alvherre.pgsql> <VisenaEmail.46.c1d7041585adc860.165a15e08a9@tc7-visena>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox