Re: concerns around pg_lsn - Mailing list pgsql-hackers

From Robert Haas
Subject Re: concerns around pg_lsn
Date
Msg-id CA+TgmoZBEqbGYLJ3pBtAm7-Qb+zTWEJV6zM-Jm2qpcEPOBw8jw@mail.gmail.com
Whole thread Raw
In response to Re: concerns around pg_lsn  (Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>)
Responses Re: concerns around pg_lsn  (Jeevan Ladhe <jeevan.ladhe@enterprisedb.com>)
List pgsql-hackers
On Tue, Jul 30, 2019 at 4:52 AM Jeevan Ladhe
<jeevan.ladhe@enterprisedb.com> wrote:
> My only concern was something that we internally treat as invalid, why do
> we allow, that as a valid value for that type. While I am not trying to
> reinvent the wheel here, I am trying to understand if there had been any
> idea behind this and I am missing it.

Well, the word "invalid" can mean more than one thing.  Something can
be valid or invalid depending on context.  I can't have -2 dollars in
my wallet, but I could have -2 dollars in my bank account, because the
bank will allow me to pay out slightly more money than I actually have
on the idea that I will pay them back later (and with interest!).  So
as an amount of money in my wallet, -2 is invalid, but as an amount of
money in my bank account, it is valid.

0/0 is not a valid LSN in the sense that (in current releases) we
never write a WAL record there, but it's OK to compute with it.
Subtracting '0/0'::pg_lsn seems useful as a way to convert an LSN to
an absolute byte-index in the WAL stream.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: [HACKERS] Restricting maximum keep segments by repslots
Next
From: Ibrar Ahmed
Date:
Subject: Re: SQL:2011 PERIODS vs Postgres Ranges?