Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators
Date
Msg-id 20200502022900.GD409463@paquier.xyz
Whole thread Raw
In response to Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators  (Fujii Masao <masao.fujii@oss.nttdata.com>)
Responses Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators
List pgsql-hackers
On Thu, Apr 30, 2020 at 11:40:59PM +0900, Fujii Masao wrote:
> Also the number of bytes can be added into and substracted from LSN using the
> <literal>+(pg_lsn,numeric)</literal> and <literal>-(pg_lsn,numeric)</literal>
> operators, respectively. Note that the calculated LSN should be in the range
> of <type>pg_lsn</type> type, i.e., between <literal>0/0</literal> and
> <literal>FFFFFFFF/FFFFFFFF</literal>.
> -----------------

That reads fine.

>> +   /* XXX would it be better to return NULL? */
>> +   if (NUMERIC_IS_NAN(num))
>> +       ereport(ERROR,
>> +               (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
>> +                errmsg("cannot convert NaN to pg_lsn")));
>> That would be good to test, and an error sounds fine to me.
>
> You mean that we should add the test that goes through this code block,
> into the regression test?

Yes, that looks worth making sure to track, especially if the behavior
of this code changes in the future.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Why are wait events not reported even though it reads/writes atimeline history file?
Next
From: Michael Paquier
Date:
Subject: Rotten parts of src/backend/replication/README