Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: jgdr(at)dalibo(dot)com
Cc: michael(at)paquier(dot)xyz, robertmhaas(at)gmail(dot)com, masao(dot)fujii(at)oss(dot)nttdata(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators
Date: 2020-04-27 01:41:47
Message-ID: 20200427.104147.1848676018835134301.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Fri, 24 Apr 2020 12:15:26 +0200, Jehan-Guillaume de Rorthais <jgdr(at)dalibo(dot)com> wrote in
> On Fri, 24 Apr 2020 16:24:14 +0900
> Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> > On Thu, Apr 23, 2020 at 08:09:22AM -0400, Robert Haas wrote:
> > > For anyone who missed it, this idea was popular on Twitter:
> > >
> > > https://twitter.com/fujii_masao/status/1252652020487487488
> >
> > (For the sake of the archives)
> > To which Alvaro, Robert, Fabrízio de Royes Mello, Julien Rouhaud and I
> > answered positively to.
>
> And me, discretely, with a little heart.

+1. I actually sometimes need it.

y the way, -(pg_lsn, pg_lsn) yields a numeric. I feel that it could be
confusing that the new operators takes a bigint. We need to cast the
second term to bigint in the following expression.

'2/20'::pg_lsn + ('1/10'::pg_lsn - '1/5'::pg_lsn)

The new + operator is not commutative. I'm not sure it is the right
desgin to make it commutative, but it would be irritatibe if it is
not. (Or maybe we should implement them as functions rather than
operators..)

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-04-27 01:44:02 Re: Poll: are people okay with function/operator table redesign?
Previous Message Jonathan S. Katz 2020-04-27 01:23:54 Re: Poll: are people okay with function/operator table redesign?