Bug #8861 Functions: If Return is a YEAR data type, value is not shown in year format
Submitted: 1 Mar 2005 12:56 Modified: 22 Apr 2005 18:36
Reporter: Disha Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.2 OS:Any (Any)
Assigned to: Antony Curtis CPU Architecture:Any

[1 Mar 2005 12:56] Disha
Description:
If we create a function returning value of YEAR data type, pass a value to the fuction, the output from the function is not in correct year format as expected and is displayed as it is. 

How to repeat:
1. Use database 'test' i.e. execute the following SQL statement:
	use test;

2. Create and Run the follwing query:

	drop function if exists fn1//
	create function fn1( i1 year ) returns year
	begin
		return i1;
	end//  
	set @x = fn1 (05)//
	Select @x//
				
		   	
3. Observe that the execution dispalys following value of @x which is not in year format.
			
	+------+
	| @x    |
	+------+
	| 5      |
	+------+

Additional Information:
Even if input a value like 999999 which is outside the scope of year datatype the value is accepted and displayed as it is entered.

Suggested fix:
The value returned by function i.e. @x should be in year format as XXXX.
[1 Mar 2005 13:24] Omer Barnir
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/
[1 Mar 2005 13:25] Omer Barnir
Previous entry was entered in error - please ignore
[20 Apr 2005 21:11] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24176
[21 Apr 2005 12:23] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24196
[21 Apr 2005 14:38] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/24202
[21 Apr 2005 14:52] Antony Curtis
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

Fixed for 5.0.5
[22 Apr 2005 18:36] Paul Dubois
Noted in 5.0.5 changelog.