Bug #7013 Stored procedure crash if group by ... with rollup
Submitted: 5 Dec 2004 0:15 Modified: 18 Feb 2005 17:57
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3-alpha-debug OS:Linux (SUSE 9.2)
Assigned to: Per-Erik Martin CPU Architecture:Any

[5 Dec 2004 0:15] Peter Gulutzan
Description:
If a table has rows in it, and I have a stored procedure that queries the table 
using SELECT ... COUNT(column-name) ... GROUP BY column-name WITH ROLLUP, 
the server crashes. 

How to repeat:
mysql> create table t (s1 int); 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> insert into t values (0),(1) ; 
Query OK, 2 rows affected (0.00 sec) 
Records: 2  Duplicates: 0  Warnings: 0 
 
mysql> create procedure p () select s1,count(s1) from t group by s1 with rollup; 
Query OK, 0 rows affected (0.01 sec) 
 
mysql> call p(); 
+------+-----------+ 
| s1   | count(s1) | 
+------+-----------+ 
|    0 |         1 | 
|    1 |         1 | 
| NULL |         2 | 
+------+-----------+ 
3 rows in set (0.00 sec) 
 
Query OK, 0 rows affected (0.00 sec) 
 
/* at this point, the server has crashed */
[5 Dec 2004 14:11] MySQL Verification Team
Back trace:

(gdb) bt
#0  0xb7ceea21 in kill () from /lib/libc.so.6
#1  0xb7e49051 in pthread_kill () from /lib/libpthread.so.0
#2  0xb7e4942b in raise () from /lib/libpthread.so.0
#3  0xb7cee7b4 in raise () from /lib/libc.so.6
#4  0xb7cefc7d in abort () from /lib/libc.so.6
#5  0xb7ce7def in __assert_fail () from /lib/libc.so.6
#6  0x08189109 in mysql_parse (thd=0x8d3b348, inBuf=0x8d52238 "call p()", length=8)
    at sql_parse.cc:4686
#7  0x08181b7f in dispatch_command (command=COM_QUERY, thd=0x8d3b348, packet=0x8d4e1d9 "",
    packet_length=9) at sql_parse.cc:1507
#8  0x08181538 in do_command (thd=0x8d3b348) at sql_parse.cc:1315
#9  0x08180a9a in handle_one_connection (arg=0x8d3b348) at sql_parse.cc:1047
#10 0xb7e4614b in pthread_start_thread () from /lib/libpthread.so.0
#11 0xb7e461df in pthread_start_thread_event () from /lib/libpthread.so.0
#12 0xb7d7950a in clone () from /lib/libc.so.6