Re: Output of date_part('quarter', date)

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: "Denis V(dot) Osadchy" <osadchy(at)turbo(dot)nsk(dot)su>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Output of date_part('quarter', date)
Date: 2001-01-04 08:08:02
Message-ID: Pine.LNX.3.96.1010104090126.14878A-100000@ara.zf.jcu.cz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


> I tried to use function date_part('quarter', date) in query and I have
> got wrong results - for first quarter I've got all rows from 01.01 to
> 31.03
> for second - from from 01.04 to 31.07 (!!!)
> for third - from from 01.08 to 30.11 (!!!)
> for forth - from from 01.12 to 31.12 (!!!)
> -----------------------
> PostgreSQL 7.0.2 on i386-pc-bsdi4.0.1, compiled by gcc 2.7.2.1
> -----------------------

until bug will fix, in 7.0.2 you can use:

... WHERE to_char(field, 'YYYY Q') = '2000 1'

(it's - may be - faster than 2x date_part())

Karel

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2001-01-04 10:29:04 subselects doesn't work in v7.0.3
Previous Message Tom Lane 2001-01-04 03:03:20 Re: dump of functions does not handle backslashes correctly