Bug #20777 Function w BIGINT UNSIGNED shows diff. behaviour with and without --ps-protocol
Submitted: 29 Jun 2006 14:41 Modified: 4 Apr 2007 3:24
Reporter: Carsten Segieth Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S1 (Critical)
Version:5.0.23-bk OS:Linux (Linux (Suse 9.3))
Assigned to: Kristofer Pettersson CPU Architecture:Any

[29 Jun 2006 14:41] Carsten Segieth
Description:
Set to P1 / S1 as the problem was seen in the funcs_1 test suite:

Running the function shown below with and without --ps-protocol shows different behaviour:

CREATE FUNCTION fn2( f1 bigint unsigned) returns bigint unsigned
BEGIN
set f1 = (f1 / 2); set f1 = (f1 * 2); set f1 = (f1 - 10); set f1 = (f1 + 10);
return f1;
END//

... *WITH* --ps-protocol:
SELECT fn2(1.84e+19);
fn2(1.84e+19)
18400000000000000000

... *WITHOUT* --ps-protocol:
SELECT fn2(1.84e+19);
fn2(1.84e+19)
-46744073709551616

How to repeat:
include the attached file into an existing test 
or 
run "./mysql-test-run.pl --suite=funcs_1 --do-test=innodb_storedproc" with and without option "--ps-protocol" after cloning the mysql-test-extra-5.0 tree.

Suggested fix:
fix the difference ...
[29 Jun 2006 14:43] Carsten Segieth
test file

Attachment: cs_096.inc (application/octet-stream, text), 1.09 KiB.

[29 Jun 2006 23:06] Omer Barnir
Changed category to Stored Procedures since this is an internal function and not a UDF. It might be that this needs to be in the 'prepared statement' sub category.
[9 Feb 2007 11:11] Chad MILLER
5.0 patch for test case

Attachment: 20777 (application/octet-stream, text), 2.41 KiB.

[3 Apr 2007 23:19] Bugs System
Pushed into 5.0.40
[3 Apr 2007 23:21] Bugs System
Pushed into 5.1.18-beta
[4 Apr 2007 3:24] Paul Dubois
Test suite change. No changelog entry needed.