Bug #42226 ALTER DATABASE returns OK even when there are errors
Submitted: 20 Jan 2009 19:14 Modified: 29 Aug 2009 6:08
Reporter: Mark Leith Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version:5.1.30 OS:Any
Assigned to: Tatiana Azundris Nuernberg CPU Architecture:Any
Tags: alter database

[20 Jan 2009 19:14] Mark Leith
Description:
ALTER DATABASE, within mysql_alter_db(), will return OK, even if there were errors, such as writing to the binary logs, or getting global read locks etc. 

How to repeat:
N/A - Code Review

Suggested fix:
Return errors when there are errors, so that the client does not think everything went OK.
[21 Jan 2009 14:23] Mark Leith
Specifically, from mysql_alter_db() in sql/sql_db.cc:

  build_table_filename(path, sizeof(path), db, "", MY_DB_OPT_FILE, 0);
  if ((error=write_db_opt(thd, path, create_info)))
    goto exit;
...
exit:
  VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
  start_waiting_global_read_lock(thd);
exit2:
  DBUG_RETURN(error);