Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1 - Mailing list pgsql-bugs

From Peter Eisentraut
Subject Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1
Date
Msg-id 200709212055.22842.peter_e@gmx.net
Whole thread Raw
In response to Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1
List pgsql-bugs
Tom Lane wrote:
> "Eugene M. Hutorny" <eugene@ksf.kiev.ua> writes:
> > SQL statemet
> > SELECT EXTRACT(QUARTER FROM INTERVAL '1 day');
> >
> > Returns: 1
> > Expected: 0
>
> Why would you expect that?  Quarters are numbered 1 through 4.
> And it doesn't "always return 1":
>
> regression=# SELECT EXTRACT(QUARTER FROM INTERVAL '3 months');
>  date_part
> -----------
>          2
> (1 row)

SELECT EXTRACT(QUARTER FROM INTERVAL '200 days') gives 1.  Why is that?

--
Peter Eisentraut
http://developer.postgresql.org/~petere/

pgsql-bugs by date:

Previous
From: "Eugene Hutorny"
Date:
Subject: Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1
Next
From: Tom Lane
Date:
Subject: Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1