| From: | Thomas Kellerer <spam_eater(at)gmx(dot)net> |
|---|---|
| To: | pgsql-bugs(at)postgresql(dot)org |
| Subject: | Re: BUG #7967: Wrong week number in extract function |
| Date: | 2013-03-18 16:55:04 |
| Message-ID: | ki7gt2$bf1$1@ger.gmane.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-bugs |
noose(at)noose(dot)pl wrote on 18.03.2013 09:23:
> The following bug has been logged on the website:
>
> Bug reference: 7967
> Logged by: Pawel Kobylak
> Email address: noose(at)noose(dot)pl
> PostgreSQL version: 9.1.3
> Operating system: Debian
> Description:
>
> Hi,
> I'm running that query and result is ... unexpected for me...
>
> Query:
> select '2012-12-31', EXTRACT(year from '2012-12-31'::date), EXTRACT(week
> from '2012-12-31'::date)
>
> Result:
> "2012-12-31";2012;1
>
> Expected:
> "2012-12-31";2012;53
> OR
> "2012-12-31";2013;1
>
> This result is correct? Or that is little bug? :-)
> Regards,
> Pawel
Expected - or at least documented.
You are looking for "isoyear" instead of "year":
select extract(isoyear from date '2012-12-31')
Result: 2013
The same "option" is available for the to_char() function: IYYY vs. YYYY
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2013-03-18 17:05:46 | Re: BUG #7967: Wrong week number in extract function |
| Previous Message | Tom Lane | 2013-03-18 16:50:37 | Re: BUG #7968: Perl DBI segfaults in connect() |