Bug #10556 Function 'EXTRACT(type FROM date)' accepts the invalid parameters.
Submitted: 11 May 2005 14:38 Modified: 11 May 2005 16:03
Reporter: Disha Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.5-beta pre-release OS:Windows (Windows Server 2003)
Assigned to: CPU Architecture:Any

[11 May 2005 14:38] Disha
Description:
In function 'EXTRACT(type FROM date)' , 'type' accepts any parameter. It accepts 'week' as a parameter.

How to repeat:
1. delimiter //
2. create database test //
3. use test
4. set @@sql_mode='traditional'//
5. select extract(week from '2005-05-11')//
6. Execution of step (5) displays the result as,
+---------------------------------+
| extract(week from '2005-05-11') |
+---------------------------------+
|                              19 |
+---------------------------------+

Expected Result: The function should not accept the invalid parameters for 'type'.

Actual Result  : The function accepts 'week' as a parameter.
[11 May 2005 16:03] MySQL Verification Team
According the Manual:
http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html

The EXTRACT() function uses the same kinds of interval type specifiers as DATE_ADD() or DATE_SUB(), but extracts parts from the date rather than performing date arithmetic.

 The following table shows how the type and expr arguments are related:
type Value 	Expected expr Format
MICROSECOND 	MICROSECONDS
SECOND 	SECONDS
MINUTE 	MINUTES
HOUR 	HOURS
DAY 	DAYS
WEEK 	WEEKS