Re: [Patch] New psql prompt substitution %r (m = master, r = replica) - Mailing list pgsql-hackers

From David Fetter
Subject Re: [Patch] New psql prompt substitution %r (m = master, r = replica)
Date
Msg-id 20160811234529.GA23502@fetter.org
Whole thread Raw
In response to [Patch] New psql prompt substitution %r (m = master, r = replica)  (Aleksander Alekseev <a.alekseev@postgrespro.ru>)
List pgsql-hackers
On Thu, Aug 11, 2016 at 01:04:19PM +0300, Aleksander Alekseev wrote:
> Hello.
> 
> Suggested patch introduces an %r substitution in psql's prompt. This
> substitution allows to display whether user is connected to master or
> replica right in a prompt.

This is a neat idea, but there are some issues.

- There's a new GUC.  This is probably not compelling enough a feature for that.

- The check, if I understand correctly, is only done on connect, even though it could change during a session.

How about something that:

- Allowed setting a query to be executed after each command.

- Put the results of that query into a psql variable.

This differs from \gset in that it would be executed silently at the
end of each command.

What say?

Best,
David.
-- 
David Fetter <david(at)fetter(dot)org> http://fetter.org/
Phone: +1 415 235 3778  AIM: dfetter666  Yahoo!: dfetter
Skype: davidfetter      XMPP: david(dot)fetter(at)gmail(dot)com

Remember to vote!
Consider donating to Postgres: http://www.postgresql.org/about/donate



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: new autovacuum criterion for visible pages
Next
From: Tom Lane
Date:
Subject: Re: new autovacuum criterion for visible pages