Bug #6642 Stored procedure crash if expression with set function

Submitted: 15 Nov 2004 18:24 Modified: 18 Feb 2005 17:56
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.2-alpha-debug OS:Linux (SuSE 8.2)
Assigned to: Per-Erik Martin CPU Architecture:Any

[15 Nov 2004 18:24] Peter Gulutzan
Description:
If a stored procedure contains a SELECT which contains an expression which contains a 
set function (AVG, MIN, SUM, MAX, COUNT), calling the procedure twice causes a crash. 
 

How to repeat:
mysql> create table t (s1 int); 
Query OK, 0 rows affected (0.73 sec) 
 
mysql> create procedure p () select abs(count(s1)) from t; 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> call p(); 
+----------------+ 
| abs(count(s1)) | 
+----------------+ 
|              0 | 
+----------------+ 
1 row in set (0.00 sec) 
 
Query OK, 0 rows affected (0.00 sec) 
 
mysql> call p(); 
ERROR 2006 (HY000): MySQL server has gone away 
No connection. Trying to reconnect... 
ERROR 2002 (HY000): Can't connect to local MySQL server through socket 
'/tmp/mysql.sock' (111) 
ERROR: 
Can't connect to the server
[15 Nov 2004 19:52] MySQL Verification Team
Back trace:

(gdb) bt
#0  0xb7cefa21 in kill () from /lib/libc.so.6
#1  0xb7e4a051 in pthread_kill () from /lib/libpthread.so.0
#2  0xb7e4a42b in raise () from /lib/libpthread.so.0
#3  0xb7cef7b4 in raise () from /lib/libc.so.6
#4  0xb7cf0c7d in abort () from /lib/libc.so.6
#5  0xb7ce8def in __assert_fail () from /lib/libc.so.6
#6  0x08184cd9 in mysql_parse (thd=0x8d34ad8, inBuf=0x8d417d0 "call p()", length=8) at sql_parse.cc:4614
#7  0x0817dadf in dispatch_command (command=COM_QUERY, thd=0x8d34ad8, packet=0x8d2c369 "", packet_length=9)
    at sql_parse.cc:1503
#8  0x0817d498 in do_command (thd=0x8d34ad8) at sql_parse.cc:1311
#9  0x0817c9fa in handle_one_connection (arg=0x8d34ad8) at sql_parse.cc:1047
#10 0xb7e4714b in pthread_start_thread () from /lib/libpthread.so.0
#11 0xb7e471df in pthread_start_thread_event () from /lib/libpthread.so.0
#12 0xb7d7a50a in clone () from /lib/libc.so.6

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.038 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.