Bug #3671 | Stored procedure crash if function has "set @variable=param" | ||
---|---|---|---|
Submitted: | 6 May 2004 2:27 | Modified: | 13 Mar 2005 7:32 |
Reporter: | Peter Gulutzan | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S3 (Non-critical) |
Version: | 5.0.1-alpha-debug | OS: | Linux (SuSE 8.2) |
Assigned to: | Dmitry Lenev | CPU Architecture: | Any |
[6 May 2004 2:27]
Peter Gulutzan
[6 May 2004 21:27]
Dean Ellis
I do not get the disconnect with 5.0.1-alpha (current as I write this), but the results are incorrect (6 rows: '', '5', '', '5', '', '5').
[30 Jul 2004 18:29]
Peter Gulutzan
Another way to crash, still using "SET @variable ..." but with no parameter, is this: mysql> create table t7 (s1 int,s2 int)// Query OK, 0 rows affected (0.56 sec) mysql> insert into t7 values (1,2)// Query OK, 1 row affected (0.01 sec) mysql> create function f7 () returns int begin set @a = @a; return @a; end;// Query OK, 0 rows affected (0.00 sec) mysql> set @a = 1;// Query OK, 0 rows affected (0.00 sec) mysql> select * from t7 where s1 = f7() and s2 = f7()+1// Query OK, 0 rows affected (0.00 sec) mysql> select f7()// 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 ... Incidentally, I suppose this is less important than the crash, but: the "select * from t7 where s1 = f7() and s2 = f7()+1//" statement should have returned one row. And if you fix that, then I intend to change the set statement to "set @a = @a + 1" so that the function is non-deterministic.
[13 Mar 2005 7:32]
Dmitry Lenev
Hi, Peter! I can not repeat these crashes with current snapshot of 5.0. All your queries work and return expected results (Except may be your example with non-deterministic function, but it is hard to say which is the correct result for it... Probably it should be reported as separate issue if the result is wrong). Also since the time you have reported this bug I have done some fixes to the code which was the first suspect for causing these crashes. So I am closing this bug as fixed in 5.0.3.