Bug #30454 'default_week_format' has no effect on YEARWEEK() as it has on WEEK()
Submitted: 16 Aug 2007 13:49 Modified: 16 Aug 2007 14:43
Reporter: Marcel Brouillet Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S3 (Non-critical)
Version:5.0.26-log/5.1 OS:Linux (Gentoo kernel 2.6.18-gentoo-r6-nopatch-xxxx-ipv4-32)
Assigned to: CPU Architecture:Any
Triage: Triaged: D2 (Serious) / R3 (Medium) / E3 (Medium)

[16 Aug 2007 13:49] Marcel Brouillet
Description:
While setting default_week_format has an effect on the function WEEK(), it does not have an effect on YEARWEEK() as one would expect.

For more info, see my comment on the documentation page 
http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

How to repeat:
Execute the following line (2007-07-16 is a Monday):
mysql>SET default_week_format=0; select WEEK('2007-07-16'), YEARWEEK('2007-07-16'); SET default_week_format=1; select WEEK('2007-07-16'), YEARWEEK('2007-07-16');

Query OK, 0 rows affected (0.04 sec)

+--------------------+------------------------+
| WEEK('2007-07-16') | YEARWEEK('2007-07-16') |
+--------------------+------------------------+
|                 28 |                 200728 | 
+--------------------+------------------------+
1 row in set (0.04 sec)

Query OK, 0 rows affected (0.04 sec)

+--------------------+------------------------+
| WEEK('2007-07-16') | YEARWEEK('2007-07-16') |
+--------------------+------------------------+
|                 29 |                 200728 | 
+--------------------+------------------------+
1 row in set (0.03 sec)
[16 Aug 2007 14:43] Miguel Solorzano
Thank you for the bug report.
[15 Jan 2009 9:51] Mattias Jonsson
before pushing the fix for default_week_format affecting YEARWEEK(), please do disable YEARWEEK() function for partitioning, since it would not longer be deterministic. (Allowing YEARWEEK(<date>,<mode>) is OK, but not YEARWEEK(<date>)).
[28 Sep 2010 14:07] Mattias Jonsson
Marked bug#24956 as a duplicate of this.