| Bug #5877 | server crashes when field in cursor is fetched into the variable with same name | ||
|---|---|---|---|
| Submitted: | 4 Oct 2004 12:47 | Modified: | 4 Oct 2004 21:02 |
| Reporter: | Levap Aretnyd | Email Updates: | |
| Status: | Can't repeat | Impact on me: | |
| Category: | MySQL Server | Severity: | S1 (Critical) |
| Version: | 5.0.1-alpha-nt | OS: | Windows (Windows 2003 web) |
| Assigned to: | CPU Architecture: | Any | |
[4 Oct 2004 21:02]
MySQL Verification Team
Hi,
Thank you for the report, but I can't repeat it on the 5.0.2-debug-log:
mysql> delimiter //
mysql> CREATE PROCEDURE `curdemo`()
-> BEGIN
-> DECLARE done INT DEFAULT 0;
-> DECLARE jmeno VARCHAR(64) DEFAULT '';
-> DECLARE cur CURSOR FOR SELECT `jmeno` FROM `fjmena` LIMIT 10;
-> DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1;
-> OPEN cur;
-> REPEAT
-> FETCH cur INTO jmeno;
-> UNTIL done END REPEAT;
-> CLOSE cur;
-> END//
Query OK, 0 rows affected (0.00 sec)
mysql> call curdemo()//
Query OK, 0 rows affected (0.00 sec)
[4 Oct 2004 23:28]
Levap Aretnyd
I've built lastest 5.0.2 snapshot and problem is gone. Sorry about not using lastest snapshot.

Description: When the CURSOR in stored procedure with select and some filelds is fetched into a variable(s) that has a same name as the source field - server crashes. How to repeat: This slightly modifed example from manual crashes the server: mysql> delimiter // mysql> CREATE PROCEDURE `cdklubcz3`.`curdemo`() -> BEGIN -> DECLARE done INT DEFAULT 0; -> DECLARE jmeno VARCHAR(64) DEFAULT ''; -> DECLARE cur CURSOR FOR SELECT `jmeno` FROM `fjmena` LIMIT 10; -> DECLARE CONTINUE HANDLER FOR SQLSTATE '02000' SET done = 1; -> OPEN cur; -> REPEAT -> FETCH cur INTO jmeno; -> UNTIL done END REPEAT; -> CLOSE cur; -> END// mysql> call curdemo()// ERROR 2013 (HY000): Lost connection to MySQL server during query When the local variable 'jmeno' is changed to something else, no problem occures. No problem occures also, when an another field (instead of `jmeno` from `fjmena`) is selected. Definiton of `fjmena` table is as follows: CREATE TABLE `fjmena` ( `id` int(10) unsigned NOT NULL auto_increment, `jmeno` varchar(64) collate utf8_czech_ci NOT NULL default '', `jmenosort` varchar(64) collate utf8_czech_ci NOT NULL default '', PRIMARY KEY (`id`), UNIQUE KEY `jmeno` (`jmeno`), KEY `jmenosort` (`jmenosort`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci