Re: Add %r substitution for psql prompts to show recovery status - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Add %r substitution for psql prompts to show recovery status
Date
Msg-id 77ec3f86-bee3-e0cf-e947-7b7d2653ed20@2ndquadrant.com
Whole thread Raw
In response to Re: Add %r substitution for psql prompts to show recovery status  (Tatsuo Ishii <ishii@sraoss.co.jp>)
Responses Re: Add %r substitution for psql prompts to show recovery status
List pgsql-hackers
On 12/7/17 19:54, Tatsuo Ishii wrote:
>> On Wed, Dec 6, 2017 at 9:19 PM, Ian Barwick <ian.barwick@2ndquadrant.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.

I agree a backend status message is the right way to do this.

We could perhaps report transaction_read_only, if we don't want to add a
new one.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Removing useless DISTINCT clauses
Next
From: Andrew Dunstan
Date:
Subject: Re: [HACKERS] SQL/JSON in PostgreSQL