Bug #36089 drop temp table in SP called by function, crash
Submitted: 15 Apr 2008 11:21 Modified: 1 Mar 2011 14:22
Reporter: Matthias Leich Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Stored Routines Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[15 Apr 2008 11:21] Matthias Leich
Description:
CREATE TEMPORARY TABLE t1 AS SELECT 1 AS a;
CREATE PROCEDURE p1()
BEGIN
DROP TEMPORARY TABLE t1;
CREATE TEMPORARY TABLE t1 AS SELECT 'abc' AS a;
end|
CREATE FUNCTION f1() RETURNS INT
BEGIN
CALL p1();
RETURN 1;
END|
SELECT 1 FROM t1 HAVING COUNT(*) = f1();
At line 22: query 'SELECT 1 FROM t1 HAVING COUNT(*) = f1()'
 failed: 2013: Lost connection to MySQL server during query

I am aware that the test above is most probably
far away of any "real world" application.

My environment:
- mysql-5.1 main last ChangeSet@1.2561, 2008-04-01
  Bug occurs
- mysql-5.1-27430 last ChangeSet@1.2589, 2008-04-08
  Bug occurs
- mysql-5.0 main last ChangeSet@1.2610, 2008-04-01
  no Bug
- all releases above compiled from source with
  BUILD/compile-pentium-debug-max
- Intel Core2Duo (64 Bit)
- SuSE Linux 10.3 (64 Bit)

How to repeat:
Please run the attached testscript or have a look
into the other files (master.err,backtrace.txt).
[15 Apr 2008 11:49] Matthias Leich
testscript

Attachment: ml003.test (application/octet-stream, text), 600 bytes.

[15 Apr 2008 11:50] Matthias Leich
server error log

Attachment: master.err (application/octet-stream, text), 3.38 KiB.

[15 Apr 2008 11:51] Matthias Leich
stack backtrace

Attachment: backtrace.txt (text/plain), 2.10 KiB.

[15 Apr 2008 13:20] Konstantin Osipov
This assert was added by the patch for 12713.
5.0 has the same bug, silenced.
[1 Mar 2011 14:22] Jon Olav Hauglid
Closing as a duplicate of Bug#30882.