Re: BUG #13845: Incorrect week number

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: "Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de>
Cc: kees.westerlaken@valuecare.nl, Pg Bugs <pgsql-bugs@postgresql.org>
Date: 2016-01-05T15:10:53Z
Lists: pgsql-bugs
"Shulgin, Oleksandr" <oleksandr.shulgin@zalando.de> writes:
> Scratch that, I'm confused about YYYY format, has to use IYYY instead.

Exactly.  There's no bug here, it's just that you have to use IYYY
together with IW if you want sensible results.

Per the fine manual:

    Caution: While to_date will reject a mixture of Gregorian and ISO
    week-numbering date fields, to_char will not, since output format
    specifications like YYYY-MM-DD (IYYY-IDDD) can be useful. But avoid
    writing something like IYYY-MM-DD; that would yield surprising results
    near the start of the year.

			regards, tom lane