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

From Eugene Hutorny
Subject Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1
Date
Msg-id 004d01c7fc72$1d56d650$82a8a8c0@ksf
Whole thread Raw
In response to BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1  ("Eugene M. Hutorny" <eugene@ksf.kiev.ua>)
List pgsql-bugs
I expect 0 because

SELECT EXTRACT(YEAR FROM INTERVAL '1 day'), EXTRACT(MONTH FROM INTERVAL '1
day')

returns 0,0

----- Original Message -----
From: "Tom Lane" <tgl@sss.pgh.pa.us>
To: "Eugene M. Hutorny" <eugene@ksf.kiev.ua>
Cc: <pgsql-bugs@postgresql.org>
Sent: Friday, September 21, 2007 7:21 PM
Subject: Re: [BUGS] BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns
1


"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)

regression=# SELECT EXTRACT(QUARTER FROM INTERVAL '11 months');
 date_part
-----------
         4
(1 row)


regards, tom lane

pgsql-bugs by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: CREATE USER and createuser not working the same
Next
From: Peter Eisentraut
Date:
Subject: Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1