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

From Kyotaro Horiguchi
Subject Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators
Date
Msg-id 20200427.104147.1848676018835134301.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators  (Jehan-Guillaume de Rorthais <jgdr@dalibo.com>)
Responses Re: +(pg_lsn, int8) and -(pg_lsn, int8) operators  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
At Fri, 24 Apr 2020 12:15:26 +0200, Jehan-Guillaume de Rorthais <jgdr@dalibo.com> wrote in
> On Fri, 24 Apr 2020 16:24:14 +0900
> Michael Paquier <michael@paquier.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



pgsql-hackers by date:

Previous
From: "Jonathan S. Katz"
Date:
Subject: Re: Poll: are people okay with function/operator table redesign?
Next
From: Tom Lane
Date:
Subject: Re: Poll: are people okay with function/operator table redesign?