Bug #8405 Stored procedure crash if function causes reference to same table
Submitted: 9 Feb 2005 23:00 Modified: 7 Mar 2005 22:56
Reporter: Peter Gulutzan
Status: Closed
Category:Server Severity:S3 (Non-critical)
Version:5.0.3-alpha-debug OS:Linux (SUSE 9.2)
Assigned to: Dmitri Lenev Target Version:

[9 Feb 2005 23:00] Peter Gulutzan
Description:
If a function refers to a table, and I use that function while
I'm selecting from that table, I get a crash.
(This depends on a new 'feature' to allow table references in functions.)

How to repeat:
mysql> create table t44 (s1 int, s2 int)//
Query OK, 0 rows affected (0.01 sec)

mysql> create function f44 () returns int return (select sum(s2) from t)//
Query OK, 0 rows affected (0.00 sec)

mysql> select f44() from t44//
Empty set (0.00 sec)

mysql> insert into t44 values (1,1)//
Query OK, 1 row affected (0.00 sec)

mysql> select f44() from t44//
ERROR 2013 (HY000): Lost connection to MySQL server during query
[9 Feb 2005 23:05] Miguel Solorzano
Thank you for the bug report I was able to repeat with latest
BK source.
[9 Feb 2005 23:07] Jorge del Conde
Reproduced with 5.0.3 compiled from todays bk tree
[4 Mar 2005 19:39] Dmitri Lenev
Hi, Peter!

I suspect that there is an error in your test case. In your function you are referencing
to table 't' instead of table 't44'.

After recent fixes in SP-locking both variants of test (with t and t44) work as expected.
[4 Mar 2005 19:40] Dmitri Lenev
Fixed in 5.0.3
[7 Mar 2005 22:56] Paul DuBois
Noted in 5.0.3 changelog.