Bug #12979 Stored procedures: crash if inout decimal parameter
Submitted: 4 Sep 2005 21:30 Modified: 14 Sep 2005 18:16
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.13-beta-debug OS:Linux (SUSE 9.2)
Assigned to: Petr Chardin CPU Architecture:Any

[4 Sep 2005 21:30] Peter Gulutzan
Description:
I have a stored procedure which inputs and outputs an INOUT parameter.
It crashes when I call it.
The crash happens only if the parameter is DECIMAL.
The crash happens only if the input value is NULL.

How to repeat:
mysql> CREATE PROCEDURE P2 (INOUT d DECIMAL(5)) SET d = d / 2;
Query OK, 0 rows affected (0.00 sec)

mysql> SET @d = NULL;
Query OK, 0 rows affected (0.01 sec)

mysql> CALL p2 (@d);
ERROR 2013 (HY000): Lost connection to MySQL server during query
[5 Sep 2005 7:32] Valeriy Kravchuk
I tried to repeat on my 5.0.13-BK build on Linux:

[openxs@Fedora mysql-5.0]$ bk changes | head
ChangeSet@1.1943, 2005-09-02 08:38:48+02:00, msvensson@neptunus.(none)

mysql> CREATE PROCEDURE P2 (INOUT d DECIMAL(5)) SET d = d / 2;
Query OK, 0 rows affected (0,07 sec)

mysql> set @d = NULL;
Query OK, 0 rows affected (0,00 sec)

mysql> call p2(@d);
Query OK, 0 rows affected (0,00 sec)

mysql> select @d;
+----------+
| @d       |
+----------+
| 0.000000 |
+----------+
1 row in set (0,01 sec)

mysql> select version();
+-------------+
| version()   |
+-------------+
| 5.0.13-beta |
+-------------+
1 row in set (0,00 sec)

I'll try to repeat on today's build later, if needed.
[5 Sep 2005 19:18] Miguel Solorzano
miguel@hegel:~/dbs/5.0> bin/mysql -uroot gh
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.13-beta-debug

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

mysql> CREATE PROCEDURE P2 (INOUT d DECIMAL(5)) SET d = d / 2;
Query OK, 0 rows affected (0.01 sec)

mysql> SET @d = NULL;
Query OK, 0 rows affected (0.00 sec)

mysql> CALL p2 (@d);
ERROR 2013 (HY000): Lost connection to MySQL server during query
mysql> 

050905 16:19:04 [Note] /home/miguel/dbs/5.0/libexec/mysqld: ready for connections.
Version: '5.0.13-beta-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
[New Thread 1132456880 (LWP 19839)]
mysqld: item_func.h:383: virtual longlong Item_func_div::int_op(): Assertion `0' failed.

Program received signal SIGABRT, Aborted.
[Switching to Thread 1132456880 (LWP 19839)]
0xffffe410 in ?? ()
(gdb) backtrace full
#0  0xffffe410 in ?? ()
No symbol table info available.
#1  0x437fd21c in ?? ()
No symbol table info available.
<cut>
[14 Sep 2005 3:31] 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/29784
[14 Sep 2005 11:25] Petr Chardin
pushed into 5.0.13
[14 Sep 2005 18:16] Paul Dubois
Noted in 5.0.13 changelog.