Re: make_interval ??

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Josh Berkus <josh(at)agliodbs(dot)com>
Cc: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: make_interval ??
Date: 2013-12-21 08:41:12
Message-ID: CAFj8pRBT3jmiGNWQZrhBPA0cr4XfF5+OKHqiwSxBLyCoeo4AQg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello

here is patch

postgres=# select make_interval(years := 1, months := 6);
make_interval
---------------
1 year 6 mons
(1 row)

postgres=# select make_interval(weeks := 3);
make_interval
---------------
21 days
(1 row)

postgres=# select make_interval(days := 10);
make_interval
---------------
10 days
(1 row)

postgres=# select make_interval(hours := 2, mins := 10, secs := 25.33);
make_interval
---------------
02:10:25.33
(1 row)

Regards

Pavel

2013/12/21 Josh Berkus <josh(at)agliodbs(dot)com>

> On 12/20/2013 04:44 PM, Gavin Flower wrote:
> > On 21/12/13 13:40, Josh Berkus wrote:
> >> On 12/20/2013 03:09 PM, Gavin Flower wrote:
> >>> What about leap years?
> >> What about them?
> >>
> > some years have 365 days others have 366, so how any days in an interval
> > of 2 years?, 4 years?
>
> Your question isn't relevant to this patch. It's not defining the
> interval type, just creating an alternate constructor for it.
>
> (the answer is, it depends on what timestamp you're adding it to ...)
>
> --
> Josh Berkus
> PostgreSQL Experts Inc.
> http://pgexperts.com
>
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers
>

Attachment Content-Type Size
make_timestamp-2013-12-21-01.patch text/x-patch 27.6 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2013-12-21 08:49:17 ISN extension bug?
Previous Message Peter Geoghegan 2013-12-21 07:59:30 Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE