Bug #1653 Stored Procedure Crash if second time after table change
Submitted: 24 Oct 2003 19:43 Modified: 5 Dec 2003 9:58
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0 OS:Linux (SuSE 8.2)
Assigned to: Bugs System CPU Architecture:Any

[24 Oct 2003 19:43] Peter Gulutzan
If a stored procedure fails the first time, then the table changes, then the stored procedure 
is re-run, the stored procedure crashes. 

How to repeat:
mysql> create table table_1 (column_1_0 int); 
Query OK, 0 rows affected (0.00 sec) 
mysql> create procedure reset_table_1 () update table_1 set column_1 = 0; 
Query OK, 0 rows affected (0.01 sec) 
mysql> call reset_table_1(); 
ERROR 1054 (42S22): Unknown column 'column_1' in 'field list' 
mysql> drop table table_1; 
Query OK, 0 rows affected (0.00 sec) 
mysql> create table table_1 (column_1 int); 
Query OK, 0 rows affected (0.00 sec) 
mysql> call reset_table_1(); 
ERROR 2013 (HY000): Lost connection to MySQL server during query
[27 Oct 2003 3:08] Indrek Siitan
Stack trace:

#0  0x808e243 in get_lock_data (thd=0xa980018, table_ptr=0xaa0a090, count=1, 
    get_old_locks=false, write_lock_used=0xaa04648) at lock.cc:406
#1  0x808da98 in mysql_lock_tables (thd=0xa980018, tables=0xaa0a090, count=1)
    at lock.cc:93
#2  0x80bce91 in lock_tables (thd=0xa980018, tables=0xaa32200)
    at sql_base.cc:1557
#3  0x80bcde5 in open_and_lock_tables (thd=0xa980018, tables=0xaa32200)
    at sql_base.cc:1516
#4  0x80de264 in mysql_update (thd=0xa980018, table_list=0xaa32200, 
    fields=@0x8505938, values=@0x8505b28, conds=0x0, order_num=0, order=0x0, 
    limit=4294967295, handle_duplicates=DUP_ERROR) at sql_update.cc:79
#5  0x80a1f65 in mysql_execute_command (thd=0xa980018) at sql_parse.cc:2408
#6  0x815681d in sp_instr_stmt::exec_stmt (this=0xaa32350, thd=0xa980018, 
    lex=0x8505800) at sp_head.cc:675
#7  0x8156667 in sp_instr_stmt::execute (this=0xaa32350, thd=0xa980018, 
    nextp=0xaa04aa4) at sp_head.cc:623
#8  0x81556c3 in sp_head::execute (this=0xaa32028, thd=0xa980018)
    at sp_head.cc:245
#9  0x8155d34 in sp_head::execute_procedure (this=0xaa32028, thd=0xa980018, 
    args=0xa9805b8) at sp_head.cc:426
#10 0x80a43e8 in mysql_execute_command (thd=0xa980018) at sql_parse.cc:3376
#11 0x80a5895 in mysql_parse (thd=0xa980018, 
    inBuf=0xaa0a028 "call reset_table_1()", length=20) at sql_parse.cc:3977
#12 0x809f4f7 in dispatch_command (command=COM_QUERY, thd=0xa980018, 
    packet=0xa9d0019 "call reset_table_1()", packet_length=21)
    at sql_parse.cc:1310
#13 0x809eefa in do_command (thd=0xa980018) at sql_parse.cc:1144
#14 0x809e593 in handle_one_connection (arg=0xa980018) at sql_parse.cc:911
#15 0x2853541f in _thread_start () from /usr/lib/libc_r.so.4
#16 0x0 in ?? ()
[5 Dec 2003 9:58] Per-Erik Martin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at