Commit 7370b241 authored by unknown's avatar unknown

fix for bug #12591 (SHOW TABLES FROM dbname produces wrong error message)


mysql-test/r/show_check.result:
  results for test for bug #12591
mysql-test/t/show_check.test:
  test for bug #12591
sql/sql_show.cc:
  don't let my_dir() emit a message bug catch the errno (my_errno - a thread specific variable) and check it for ENOENT - not existing.
  For other errors emulate the message used to be emitted by my_dir()
parent f2cc5f25
...@@ -555,3 +555,5 @@ Database Table In_use Name_locked ...@@ -555,3 +555,5 @@ Database Table In_use Name_locked
DROP TABLE txt1; DROP TABLE txt1;
DROP TABLE tyt2; DROP TABLE tyt2;
DROP TABLE urkunde; DROP TABLE urkunde;
SHOW TABLES FROM non_existing_database;
ERROR 42000: Unknown database 'non_existing_database'
...@@ -405,3 +405,8 @@ SHOW OPEN TABLES; ...@@ -405,3 +405,8 @@ SHOW OPEN TABLES;
DROP TABLE txt1; DROP TABLE txt1;
DROP TABLE tyt2; DROP TABLE tyt2;
DROP TABLE urkunde; DROP TABLE urkunde;
#
# BUG #12591 (SHOW TABLES FROM dbname produces wrong error message)
#
--error 1049
SHOW TABLES FROM non_existing_database;
...@@ -264,8 +264,14 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path, ...@@ -264,8 +264,14 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
bzero((char*) &table_list,sizeof(table_list)); bzero((char*) &table_list,sizeof(table_list));
if (!(dirp = my_dir(path,MYF(MY_WME | (dir ? MY_WANT_STAT : 0))))) if (!(dirp = my_dir(path,MYF(dir ? MY_WANT_STAT : 0))))
{
if (my_errno == ENOENT)
my_error(ER_BAD_DB_ERROR, MYF(ME_BELL+ME_WAITTANG), db);
else
my_error(ER_CANT_READ_DIR, MYF(ME_BELL+ME_WAITTANG), path, my_errno);
DBUG_RETURN(-1); DBUG_RETURN(-1);
}
for (i=0 ; i < (uint) dirp->number_off_files ; i++) for (i=0 ; i < (uint) dirp->number_off_files ; i++)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment