Re: Add %r substitution for psql prompts to show recovery status

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, ian(dot)barwick(at)2ndquadrant(dot)com, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Add %r substitution for psql prompts to show recovery status
Date: 2017-12-08 21:56:03
Message-ID: CAPpHfduiDiHwC6gcJCr=f=2c62XBnvbCr-6MVLMBagw8mQ7X5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Dec 8, 2017 at 3:54 AM, Tatsuo Ishii <ishii(at)sraoss(dot)co(dot)jp> wrote:

> > On Wed, Dec 6, 2017 at 9:19 PM, Ian Barwick <ian(dot)barwick(at)2ndquadrant(dot)com>
> wrote:
> >> Note this substitution sends a "pg_is_in_recovery()" query to the server
> >> each time it's encountered; unless there's something I'm overlooking I
> >> think that's the only reliable way to determine current recovery status.
> >
> > That seems kinda painful.
> >
> > And what happens in an aborted transaction?
>
> Yeah. I think we need some from help backend for this. For example, a
> parameter status message can be used here. If PostgreSQL moves to the
> recovery state or vice versa, PostgreSQL sends the parameter status
> message to frontend.
>

If we would use parameter status messages, then can we handle compatibility
correctly? So that new psql can work with old backend without errors (and
without recovery status display, for sure), and old psql can work with new
backend without errors.

Because seeing recovery status in psql prompt is very neat. But execution
of extra query each time doesn't seem like reasonable price for it...

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message konstantin knizhnik 2017-12-08 22:09:10 Re: Postgres with pthread
Previous Message Alexander Korotkov 2017-12-08 21:49:57 Re: [HACKERS] Re: proposal - psql: possibility to specify sort for describe commands, when size is printed