Re: Proposal: Division operator for (interval / interval => double precision)

From: Kashif Zeeshan <kashi(dot)zeeshan(at)gmail(dot)com>
To: Gurjeet Singh <gurjeet(at)singh(dot)im>
Cc: Postgres Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Division operator for (interval / interval => double precision)
Date: 2024-06-24 03:54:27
Message-ID: CAAPsdhdurM7rKYPy17xtBsiPszN+vdobv1F6Uc5af71yXrZkrA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

Its always a good idea to extend the functionality of PG.

Thanks
Kashif Zeeshan

On Mon, Jun 24, 2024 at 5:57 AM Gurjeet Singh <gurjeet(at)singh(dot)im> wrote:

> Is there a desire to have a division operator / that takes dividend
> and divisor of types interval, and results in a quotient of type
> double precision.
>
> This would be helpful in calculating how many times the divisor
> interval can fit into the dividend interval.
>
> To complement this division operator, it would be desirable to also
> have a remainder operator %.
>
> For example,
>
> ('365 days'::interval / '5 days'::interval) => 73
> ('365 days'::interval % '5 days'::interval) => 0
>
> ('365 days'::interval / '3 days'::interval) => 121
> ('365 days'::interval % '3 days'::interval) => 2
>
> Best regards,
> Gurjeet
> http://Gurje.et
>
>
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Lakhin 2024-06-24 04:00:00 Buildfarm animal caiman showing a plperl test issue with newer Perl versions
Previous Message Yugo NAGATA 2024-06-24 03:27:28 Re: Avoid incomplete copy string (src/backend/access/transam/xlog.c)