Bug #61998 MySQL console hangs when procedure returns result set.
Submitted: 27 Jul 2011 8:23 Modified: 27 Jul 2011 10:04
Reporter: Dima Drug Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Enterprise Monitor: Agent Severity:S3 (Non-critical)
Version:5.5.12 OS:Linux
Assigned to: Jan Kneschke CPU Architecture:Any
Tags: Stored procedure result set

[27 Jul 2011 8:23] Dima Drug
Description:
When stored procedure has cursor loop inside, it can't return result set and console hangs. 
Procedures without cursors works fine.

How to repeat:
CREATE PROCEDURE prc1()
BEGIN
  DECLARE lTblName    VARCHAR(64);
  DECLARE done        BOOL         DEFAULT False;  
  DECLARE curIndx CURSOR FOR
                    SELECT table_name
                      FROM information_schema.tables
                     WHERE table_name like 'doesnt matter';
                     
  DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = True;
  
  OPEN curIndx;
  lpIndx: LOOP
    FETCH curIndx INTO lTblName;
    IF done THEN
      LEAVE lpIndx;
    END IF;
  END LOOP; -- end of lpIndx
  CLOSE curIndx;    
  SELECT 'finished';
END;

CALL prc1;
[27 Jul 2011 9:58] Dima Drug
This bug is only reproduced when working through MySQL proxy
[27 Jul 2011 10:04] Mark Leith
Verified as described.