From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators
Date: Thu, 30 Apr 2020 23:40:59 +0900
Message-ID: <8aa9c491-c693-0e8c-66e8-eb22e72ab329@oss.nttdata.com> (raw)
In-Reply-To: <20200428060328.GF279958@paquier.xyz>
References: <CA+Tgmoa0gRq56Z517QABepGcpbK-SERkp4P+5JjuQH+3Y8v4Kw@mail.gmail.com>
<20200424072414.GP33034@paquier.xyz>
<20200424121526.399578eb@firost>
<20200427.104147.1848676018835134301.horikyota.ntt@gmail.com>
<CA+TgmobHuvqBd1SVFNQNcA=KJMKx_5wNsKTa3yqHwwqqx+wNWA@mail.gmail.com>
<c849ce81-e7bf-1d62-9b0f-959d2a1b467d@oss.nttdata.com>
<20200428060328.GF279958@paquier.xyz>
On 2020/04/28 15:03, Michael Paquier wrote:
> On Tue, Apr 28, 2020 at 12:56:19PM +0900, Fujii Masao wrote:
>> Yes. Attached is the updated version of the patch, which introduces
>> +(pg_lsn, numeric) and -(pg_lsn, numeric) operators.
>> To implement them, I added also numeric_pg_lsn() function that converts
>> numeric to pg_lsn.
>
> - those write-ahead log locations.
> + those write-ahead log locations. Also the number of bytes can be added
> + into and substracted from LSN using the <literal>+</literal> and
> + <literal>-</literal> operators, respectively.
> That's short. Should this mention the restriction with numeric (or
> just recommend its use) because we don't have a 64b unsigned type
> internally, basically Robert's point?
Thanks for the review! What about the following description?
-----------------
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>.
-----------------
>
> + /* 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?
Regards,
--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-hackers@postgresql.org
Cc: masao.fujii@oss.nttdata.com, michael@paquier.xyz, robertmhaas@gmail.com, horikyota.ntt@gmail.com, jgdr@dalibo.com
Subject: Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators
In-Reply-To: <8aa9c491-c693-0e8c-66e8-eb22e72ab329@oss.nttdata.com>
References: <CA+Tgmoa0gRq56Z517QABepGcpbK-SERkp4P+5JjuQH+3Y8v4Kw@mail.gmail.com> <20200424072414.GP33034@paquier.xyz> <20200424121526.399578eb@firost> <20200427.104147.1848676018835134301.horikyota.ntt@gmail.com> <CA+TgmobHuvqBd1SVFNQNcA=KJMKx_5wNsKTa3yqHwwqqx+wNWA@mail.gmail.com> <c849ce81-e7bf-1d62-9b0f-959d2a1b467d@oss.nttdata.com> <20200428060328.GF279958@paquier.xyz> <8aa9c491-c693-0e8c-66e8-eb22e72ab329@oss.nttdata.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox