Bug #10827 Lost connection when selecting variable value
Submitted: 24 May 2005 13:14 Modified: 24 May 2005 14:58
Reporter: Disha Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0.5-beta-nt OS:Windows (Windows xp)
Assigned to: CPU Architecture:Any

[24 May 2005 13:14] Disha
Description:
Calling function from store procedure and accessing value of store procedure lossing server connection.

How to repeat:
Repro Steps:
  
1. execute the following command.
    delimiter //
    drop function if exists fn1_05_4012011_13//
    drop procedure if exists sp1_05_4012011_13//
    Create function fn1_05_4012011_13(F1 INT) returns INT	
    Begin
	Declare x int;
	Declare y int;
	set x = F1;
	set y = x + 4294967294;
	select y;
	return y;
     End//
		
    create procedure sp1_05_4012011_13 (OUT var1 int)
    begin
             set var1 = fn1_05_4012011_13(1);
    end//
    call sp1_05_4012011_13(@a)// 
    Select @a//
 
2. Expected Result: Return variable value of @a as  4294967295
   
3.Actual Result:ERROR 2013 (HY000): Lost connection to MySQL server during 
                     query
[24 May 2005 14:14] MySQL Verification Team
I was unable to verify your test case because currently there is
the below issue:

C:\mysql\bin>mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 5.0.7-beta-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> delimiter //
mysql>     drop function if exists fn1_05_4012011_13//
Query OK, 0 rows affected, 1 warning (0.02 sec)

mysql>     drop procedure if exists sp1_05_4012011_13//
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>     Create function fn1_05_4012011_13(F1 INT) returns INT
    ->     Begin
    ->  Declare x int;
    ->  Declare y int;
    ->  set x = F1;
    ->  set y = x + 4294967294;
    ->  select y;
    ->  return y;
    ->      End//
ERROR 1415 (0A000): Not allowed to return a result set from a function
mysql>
[24 May 2005 14:58] Per-Erik Martin
This was a duplicate of BUG#8408 et al. It's not possible to return a result set ("select y") from a function, so it has been disallowed.