Thread: BUG #1094: date_part('week') bug

BUG #1094: date_part('week') bug

From
"PostgreSQL Bugs List"
Date:
The following bug has been logged online:

Bug reference:      1094
Logged by:          xterm

Email address:      xterm@linuxnews.pl

PostgreSQL version: 7.3.4

Operating system:   RH Fedora

Description:        date_part('week') bug

Details:

Some late dates give in some years wrong
date_part('week')

examples:

select date_part('week', '2003-12-30'::date);
 date_part
-----------
         1
(1 row)

select date_part('week', '1997-12-29'::date);
 date_part
-----------
         1
(1 row)

but:

select date_part('week', '1998-12-31'::date);
 date_part
-----------
        53
(1 row)

Re: BUG #1094: date_part('week') bug

From
Bruno Wolff III
Date:
On Thu, Mar 04, 2004 at 13:56:42 -0400,
  PostgreSQL Bugs List <pgsql-bugs@postgresql.org> wrote:
>
> The following bug has been logged online:

This isn't a bug. Weeks that span years are treated as part of the year
in which Thursday of that week lies.

>
> Bug reference:      1094
> Logged by:          xterm
>
> Email address:      xterm@linuxnews.pl
>
> PostgreSQL version: 7.3.4
>
> Operating system:   RH Fedora
>
> Description:        date_part('week') bug
>
> Details:
>
> Some late dates give in some years wrong
> date_part('week')
>
> examples:
>
> select date_part('week', '2003-12-30'::date);
>  date_part
> -----------
>          1
> (1 row)
>
> select date_part('week', '1997-12-29'::date);
>  date_part
> -----------
>          1
> (1 row)
>
> but:
>
> select date_part('week', '1998-12-31'::date);
>  date_part
> -----------
>         53
> (1 row)
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

Re: BUG #1094: date_part('week') bug

From
Robert Creager
Date: