Bug #14486 CREATE PROCEDURE without selecting schema crashes server
Submitted: 30 Oct 2005 6:25 Modified: 30 Oct 2005 7:06
Reporter: Mike Palmer Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.15 OS:Windows (Windows XP)
Assigned to: CPU Architecture:Any

[30 Oct 2005 6:25] Mike Palmer
Description:
When incorrectly creating a procedure, you can crash the server. Of course you shouldn't be doing this, but you shouldn't be able to crash the server if you did.

How to repeat:
connect to the server and never select a schema. (no USE someschema;) then run

CREATE PROCEDURE ptest () SELECT * FROM someschema.sometable;

server hangs and request cannot be killed.

CREATE PROCEDURE someschema.ptest () SELECT * FROM someschema.sometable;

works as expected.

Suggested fix:
produce an error and abort the request just like when you try to create a table without selecting a schema.
[30 Oct 2005 7:06] Georg Richter
Can't repeat (tested with 5.0.16)

mysql> select version() \G
*************************** 1. row ***************************
version(): 5.0.16-debug-log
1 row in set (0.00 sec)

mysql> select schema() \G
*************************** 1. row ***************************
schema(): NULL
1 row in set (0.00 sec)

mysql> create procedure ptest() SELECT * FROM test.t1;
ERROR 1046 (3D000): No database selected