Skip site navigation (1) Skip section navigation (2)

Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Eugene M(dot) Hutorny" <eugene(at)ksf(dot)kiev(dot)ua>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1
Date: 2007-09-21 16:21:44
Message-ID: 6414.1190391704@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Eugene M. Hutorny" <eugene(at)ksf(dot)kiev(dot)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

In response to

Responses

pgsql-bugs by date

Next:From: Eugene HutornyDate: 2007-09-21 17:08:59
Subject: Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1
Previous:From: Peter EisentrautDate: 2007-09-21 14:57:46
Subject: Re: BUG #3624: EXTRACT(QUARTER FROM INTERVAL) always returns 1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group