Bug #9809 Stored Procedures: Signed BigInt variables Fails to accept boundary value.
Submitted: 11 Apr 2005 10:13 Modified: 2 Dec 2005 20:38
Reporter: Disha Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3 Beta OS:Windows (Windows 2003)
Assigned to: CPU Architecture:Any

[11 Apr 2005 10:13] Disha
Description:
In default or traditional mode,
Stored Procedures: Signed BigInt variables Fails to accept boundary value, that is,
-9223372036854775808.

How to repeat:

1. DROP PROCEDURE IF EXISTS SP04//
2. CREATE PROCEDURE SP04()
    P1: BEGIN
	DECLARE TEMP_MUL BIGINT;
	DECLARE TEMP_NUM BIGINT DEFAULT -9223372036854775808;
	Set TEMP_NUM=-9223372036854775808;
	set @xxx=-9223372036854775808;
	SELECT TEMP_NUM;
	SELECT @xxx;
    END P1//
3. Call sp04()//

ACTUAL RESULT:
+----------+
| TEMP_NUM |
+----------+
|        0 |
+----------+
1 row in set (0.00 sec)

+----------------------+
| @xxx                 |
+----------------------+
| -9223372036854775808 |
+----------------------+
1 row in set (0.02 sec)

EXPECTED RESULT:
+----------+
| TEMP_NUM |
+----------+
| -9223372036854775808 |
+----------+
1 row in set (0.00 sec)

+----------------------+
| @xxx                 |
+----------------------+
| -9223372036854775808 |
+----------------------+
1 row in set (0.02 sec)
[11 Apr 2005 16:36] Trudy Pelzer
This is probably related to Bug#5913.
[14 Sep 2005 13:48] Valeriy Kravchuk
Can't repeat on 5.0.13-BK (ChangeSet@1.1941.1.1, 2005-09-13 02:31:47+02:00, kent@mysql.com) on Linux:

[openxs@Fedora 5.0]$ bin/mysql -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 to server version: 5.0.13-beta-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use test;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> delimiter //
mysql> CREATE PROCEDURE SP04()
    -> P1: BEGIN
    -> DECLARE TEMP_MUL BIGINT;
    -> DECLARE TEMP_NUM BIGINT DEFAULT -9223372036854775808;
    -> Set TEMP_NUM=-9223372036854775808;
    -> set @xxx=-9223372036854775808;
    -> SELECT TEMP_NUM;
    -> SELECT @xxx;
    -> END P1//
Query OK, 0 rows affected (0,00 sec)

mysql> call sp04()//
+----------------------+
| TEMP_NUM             |
+----------------------+
| -9223372036854775808 |
+----------------------+
1 row in set (0,00 sec)

+----------------------+
| @xxx                 |
+----------------------+
| -9223372036854775808 |
+----------------------+
1 row in set (0,00 sec)

Query OK, 0 rows affected (0,01 sec)

mysql> set sql_mode='traditional'//
Query OK, 0 rows affected (0,00 sec)

mysql> call sp04()//
+----------------------+
| TEMP_NUM             |
+----------------------+
| -9223372036854775808 |
+----------------------+
1 row in set (0,00 sec)

+----------------------+
| @xxx                 |
+----------------------+
| -9223372036854775808 |
+----------------------+
1 row in set (0,00 sec)

Query OK, 0 rows affected (0,00 sec)
[2 Dec 2005 20:38] Valeriy Kravchuk
Thank you for taking the time to report a problem.  Unfortunately
you are not using a current version of the product your reported a
problem with -- the problem might already be fixed. Please download
a new version from http://www.mysql.com/downloads/

If you are able to reproduce the bug with one of the latest versions,
please change the version on this bug report to the version you
tested and change the status back to "Open".  Again, thank you for
your continued support of MySQL.