Re: [HACKERS] pg_control_recovery() return value when not in recovery - Mailing list pgsql-hackers

From Simon Riggs
Subject Re: [HACKERS] pg_control_recovery() return value when not in recovery
Date
Msg-id CANP8+j+TnCBh7g+=dz+q0suXchReGgWA_Nc2ZWbayxxXucNAzA@mail.gmail.com
Whole thread Raw
In response to [HACKERS] pg_control_recovery() return value when not in recovery  (Andres Freund <andres@anarazel.de>)
Responses Re: [HACKERS] pg_control_recovery() return value when not in recovery  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers
On 18 September 2017 at 05:50, Andres Freund <andres@anarazel.de> wrote:
> Hi,
>
> Just noticed that we're returning the underlying values for
> pg_control_recovery() without any checks:
> postgres[14388][1]=# SELECT * FROM pg_control_recovery();
>
┌──────────────────────┬───────────────────────────┬──────────────────┬────────────────┬───────────────────────────────┐
> │ min_recovery_end_lsn │ min_recovery_end_timeline │ backup_start_lsn │ backup_end_lsn │
end_of_backup_record_required│
 
>
├──────────────────────┼───────────────────────────┼──────────────────┼────────────────┼───────────────────────────────┤
> │ 0/0                  │                         0 │ 0/0              │ 0/0            │ f
│
 
>
└──────────────────────┴───────────────────────────┴──────────────────┴────────────────┴───────────────────────────────┘
> (1 row)

Yes, that would have made sense for these to be NULL


> postgres[14388][1]=# SELECT pg_is_in_recovery();
> ┌───────────────────┐
> │ pg_is_in_recovery │
> ├───────────────────┤
> │ f                 │
> └───────────────────┘
> (1 row)

But not this, since it is a boolean and the answer is known.

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

pgsql-hackers by date:

Previous
From: "MauMau"
Date:
Subject: Re: [HACKERS] sync process names between ps and pg_stat_activity
Next
From: Andres Freund
Date:
Subject: Re: [HACKERS] pg_control_recovery() return value when not in recovery