| Bug #6663 | Stored Procedures code report non-selected DB when CREATE but not when ALTER | ||
|---|---|---|---|
| Submitted: | 16 Nov 2004 10:51 | Modified: | 12 Apr 2005 16:49 |
| Reporter: | Andrey Hristov | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server | Severity: | S3 (Non-critical) |
| Version: | 5.0.2-dev | OS: | Linux (Linux) |
| Assigned to: | Per-Erik Martin | CPU Architecture: | Any |
[12 Apr 2005 16:49]
Per-Erik Martin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.
If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information
about accessing the source trees is available at
http://www.mysql.com/doc/en/Installing_source_tree.html

Description: When the default DB is selected and CREATE PROCEDURE is issued an error message is shown that no DB is selected. However this is not true for ALTER and DROP PROCEDURE. The same affects functions. Thanks, Andrey How to repeat: mysql> delimiter | mysql> create procedure a()begin end;| ERROR 1046 (3D000): No database selected mysql> alter procedure a comment "foobar"| ERROR 1305 (42000): PROCEDURE .a does not exist mysql> drop procedure a| ERROR 1305 (42000): PROCEDURE .a does not exist mysql> select version()| +-------------------+ | version() | +-------------------+ | 5.0.2-alpha-debug | +-------------------+ 1 row in set (0.01 sec) mysql> create function a() returns int begin return 1; end;| ERROR 1046 (3D000): No database selected mysql> alter function a comment "barfoo" | ERROR 1305 (42000): FUNCTION .a does not exist mysql> drop function a | ERROR 1305 (42000): FUNCTION .a does not exist Suggested fix: Add the following (copied from SQLCOM_CREATE_PROCEDURE) to SQLCOM_ALTER_PROCEDURE and SQLCOM_DROP_PROCEDURE if (! lex->sphead->m_db.str) { my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); delete lex->sphead; lex->sphead= 0; goto error; }