Loading Docs/manual.texi +6 −0 Original line number Diff line number Diff line Loading @@ -46931,10 +46931,16 @@ not yet 100% confident in this code. @item Fixed core dump bug when using the @code{BINARY} cast on a @code{NULL} value. @item Fixed race condition when someone did a @code{GRANT} at the same time a new user logged in or did a @code{USE DATABASE}. @item Fixed bug in @code{ALTER TABLE} and @code{RENAME TABLE} when running with @code{-O lower_case_table_names=1} (typically on windows) when giving the table name in uppercase. @item Fixed that @code{-O lower_case_table_names=1} also converts database names to lower case. @item Fixed unlikely core dump with @code{SELECT ... ORDER BY ... LIMIT}. @item Changed @code{AND/OR} to report that they can return NULL. This fixes a sql/lock.cc +2 −2 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) uint key_length; DBUG_ENTER("lock_table_name"); key_length=(uint) (strmov(strmov(key,table_list->db)+1,table_list->name) key_length=(uint) (strmov(strmov(key,table_list->db)+1,table_list->real_name) -key)+ 1; /* Only insert the table if we haven't insert it already */ Loading Loading @@ -447,7 +447,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) my_free((gptr) table,MYF(0)); DBUG_RETURN(-1); } if (remove_table_from_cache(thd, table_list->db, table_list->name)) if (remove_table_from_cache(thd, table_list->db, table_list->real_name)) DBUG_RETURN(1); // Table is in use DBUG_RETURN(0); } Loading sql/slave.cc +2 −2 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, bzero((char*) &tables,sizeof(tables)); tables.db = (char*)db; tables.name = tables.real_name = (char*)table_name; tables.alias= tables.real_name= (char*)table_name; tables.lock_type = TL_WRITE; thd->proc_info = "Opening master dump table"; if (!open_ltable(thd, &tables, TL_WRITE)) Loading Loading @@ -1073,7 +1073,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) TABLE_LIST tables; bzero((char*) &tables,sizeof(tables)); tables.db = thd->db; tables.name = tables.real_name = (char*)lev->table_name; tables.alias= tables.real_name= (char*)lev->table_name; tables.lock_type = TL_WRITE; // the table will be opened in mysql_load if(table_rules_on && !tables_ok(thd, &tables)) Loading sql/sql_acl.cc +37 −27 Original line number Diff line number Diff line Loading @@ -130,9 +130,9 @@ int acl_init(bool dont_read_acl_tables) thd->open_tables=0; thd->db=my_strdup("mysql",MYF(0)); bzero((char*) &tables,sizeof(tables)); tables[0].name=tables[0].real_name=(char*) "host"; tables[1].name=tables[1].real_name=(char*) "user"; tables[2].name=tables[2].real_name=(char*) "db"; tables[0].alias=tables[0].real_name=(char*) "host"; tables[1].alias=tables[1].real_name=(char*) "user"; tables[2].alias=tables[2].real_name=(char*) "db"; tables[0].next=tables+1; tables[1].next=tables+2; tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ; Loading Loading @@ -922,7 +922,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user, DBUG_PRINT("enter",("user: %s host: %s",user,host)); bzero((char*) &tables,sizeof(tables)); tables.name=tables.real_name=(char*) "user"; tables.alias=tables.real_name=(char*) "user"; tables.db=(char*) "mysql"; if (!(table=open_ltable(thd,&tables,TL_WRITE))) DBUG_RETURN(1); /* purecov: deadcode */ Loading Loading @@ -1653,7 +1653,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, check->column.length(),0,0)) { my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0), check->column.c_ptr(),table_list->name); check->column.c_ptr(),table_list->alias); DBUG_RETURN(-1); } column_priv |= check->rights | (rights & COL_ACLS); Loading @@ -1664,11 +1664,11 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, { char buf[FN_REFLEN]; sprintf(buf,"%s/%s/%s.frm",mysql_data_home,table_list->db, table_list->name); table_list->real_name); fn_format(buf,buf,"","",4+16+32); if (access(buf,F_OK)) { my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db,table_list->name); my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db,table_list->real_name); DBUG_RETURN(-1); } } Loading @@ -1676,9 +1676,9 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, /* open the mysql.tables_priv and mysql.columns_priv tables */ bzero((char*) &tables,sizeof(tables)); tables[0].name=tables[0].real_name= (char*) "user"; tables[1].name=tables[1].real_name= (char*) "tables_priv"; tables[2].name=tables[2].real_name= (char*) "columns_priv"; tables[0].alias=tables[0].real_name= (char*) "user"; tables[1].alias=tables[1].real_name= (char*) "tables_priv"; tables[2].alias=tables[2].real_name= (char*) "columns_priv"; tables[0].next=tables+1; /* Don't open column table if we don't need it ! */ tables[1].next=((column_priv || Loading @@ -1702,6 +1702,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, while ((Str = str_list++)) { int error; GRANT_TABLE *grant_table; if (!Str->host.str) { Loading @@ -1716,11 +1717,14 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, continue; } /* Create user if needed */ if (replace_user_table(tables[0].table, pthread_mutex_lock(&acl_cache->lock); error=replace_user_table(tables[0].table, *Str, 0, revoke_grant ? 'N' : 'Y', create_new_users)) create_new_users); pthread_mutex_unlock(&acl_cache->lock); if (error) { result= -1; // Remember error continue; // Add next user Loading @@ -1729,20 +1733,20 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, /* Find/create cached table grant */ grant_table= table_hash_search(Str->host.str,NullS,table_list->db, Str->user.str, table_list->name,1); table_list->real_name,1); if (!grant_table) { if (revoke_grant) { my_printf_error(ER_NONEXISTING_TABLE_GRANT, ER(ER_NONEXISTING_TABLE_GRANT),MYF(0), Str->user.str, Str->host.str,table_list->name); Str->user.str, Str->host.str, table_list->real_name); result= -1; continue; } grant_table = new GRANT_TABLE (Str->host.str,table_list->db, Str->user.str, table_list->name, table_list->real_name, rights, column_priv); if (!grant_table) // end of memory Loading Loading @@ -1789,7 +1793,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, if (replace_table_table(thd,grant_table,tables[1].table,*Str, table_list->db, table_list->name, table_list->real_name, rights, column_priv, revoke_grant)) { // Crashend table ?? result= -1; /* purecov: deadcode */ Loading @@ -1799,7 +1803,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, if ((replace_column_table(grant_table,tables[2].table, *Str, columns, table_list->db, table_list->name, table_list->real_name, rights, revoke_grant))) { result= -1; Loading Loading @@ -1836,8 +1840,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights, /* open the mysql.user and mysql.db tables */ tables[0].name=tables[0].real_name=(char*) "user"; tables[1].name=tables[1].real_name=(char*) "db"; tables[0].alias=tables[0].real_name=(char*) "user"; tables[1].alias=tables[1].real_name=(char*) "db"; tables[0].next=tables+1; tables[1].next=0; tables[0].lock_type=tables[1].lock_type=TL_WRITE; Loading Loading @@ -1930,8 +1934,8 @@ int grant_init (void) thd->open_tables=0; thd->db=my_strdup("mysql",MYF(0)); bzero((char*) &tables,sizeof(tables)); tables[0].name=tables[0].real_name= (char*) "tables_priv"; tables[1].name=tables[1].real_name= (char*) "columns_priv"; tables[0].alias=tables[0].real_name= (char*) "tables_priv"; tables[1].alias=tables[1].real_name= (char*) "columns_priv"; tables[0].next=tables+1; tables[0].lock_type=tables[1].lock_type=TL_READ; tables[0].db=tables[1].db=thd->db; Loading Loading @@ -2270,6 +2274,7 @@ bool check_grant_db(THD *thd,const char *db) uint get_table_grant(THD *thd, TABLE_LIST *table) { uint privilege; char *user = thd->priv_user; const char *db = table->db ? table->db : thd->db; GRANT_TABLE *grant_table; Loading @@ -2281,8 +2286,9 @@ uint get_table_grant(THD *thd, TABLE_LIST *table) table->grant.version=grant_version; if (grant_table) table->grant.privilege|= grant_table->privs; privilege= table->grant.privilege; pthread_mutex_unlock(&LOCK_grant); return table->grant.privilege; return privilege; } Loading Loading @@ -2335,7 +2341,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) int error = 0; ACL_USER *acl_user; ACL_DB *acl_db; char buff[1024]; DBUG_ENTER("mysql_grant"); DBUG_ENTER("mysql_show_grants"); LINT_INIT(acl_user); if (!initialized) Loading Loading @@ -2384,6 +2390,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) if (send_fields(thd,field_list,1)) DBUG_RETURN(-1); pthread_mutex_lock(&LOCK_grant); VOID(pthread_mutex_lock(&acl_cache->lock)); /* Add first global access grants */ Loading Loading @@ -2578,13 +2585,16 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) thd->packet.length())) { error=-1; goto end; break; } } } } end: VOID(pthread_mutex_unlock(&acl_cache->lock)); pthread_mutex_unlock(&LOCK_grant); send_eof(&thd->net); DBUG_RETURN(error); } Loading sql/sql_base.cc +8 −8 Original line number Diff line number Diff line Loading @@ -354,7 +354,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, bool found=0; for (TABLE_LIST *table=tables ; table ; table=table->next) { if (remove_table_from_cache(thd, table->db, table->name, 1)) if (remove_table_from_cache(thd, table->db, table->real_name, 1)) found=1; } if (!found) Loading Loading @@ -715,7 +715,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) DBUG_RETURN(0); char* db = thd->db ? thd->db : table_list->db; char* table_name = table_list->name; char* table_name = table_list->real_name; char key[MAX_DBKEY_LENGTH]; uint key_length; key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; Loading Loading @@ -1285,7 +1285,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, TABLE_LIST table_list; table_list.db=(char*) db; table_list.name=(char*) name; table_list.real_name=(char*) name; table_list.next=0; if ((error=lock_table_name(thd,&table_list))) { Loading Loading @@ -1356,7 +1356,7 @@ int open_tables(THD *thd,TABLE_LIST *start) !(tables->table=open_table(thd, tables->db ? tables->db : thd->db, tables->real_name, tables->name, &refresh))) tables->alias, &refresh))) { if (refresh) // Refresh in progress { Loading Loading @@ -1412,7 +1412,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type) thd->proc_info="Opening table"; while (!(table=open_table(thd,table_list->db ? table_list->db : thd->db, table_list->real_name,table_list->name, table_list->real_name, table_list->alias, &refresh)) && refresh) ; if (table) { Loading Loading @@ -1440,7 +1440,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type) { my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, ER(ER_TABLE_NOT_LOCKED_FOR_WRITE), MYF(0),table_list->name); MYF(0),table_list->alias); table=0; } else if ((error=table->file->start_stmt(thd))) Loading Loading @@ -1642,7 +1642,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables) bool found_table=0; for (; tables ; tables=tables->next) { if (!strcmp(tables->name,table_name) && if (!strcmp(tables->alias,table_name) && (!db || (tables->db && !strcmp(db,tables->db)) || (!tables->db && !strcmp(db,thd->db)))) Loading Loading @@ -1882,7 +1882,7 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name, if (grant_option && !thd->master_access && check_grant_all_columns(thd,SELECT_ACL,table) ) DBUG_RETURN(-1); if (!table_name || (!strcmp(table_name,tables->name) && if (!table_name || (!strcmp(table_name,tables->alias) && (!db_name || !tables->db || !strcmp(tables->db,db_name)))) { Loading Loading
Docs/manual.texi +6 −0 Original line number Diff line number Diff line Loading @@ -46931,10 +46931,16 @@ not yet 100% confident in this code. @item Fixed core dump bug when using the @code{BINARY} cast on a @code{NULL} value. @item Fixed race condition when someone did a @code{GRANT} at the same time a new user logged in or did a @code{USE DATABASE}. @item Fixed bug in @code{ALTER TABLE} and @code{RENAME TABLE} when running with @code{-O lower_case_table_names=1} (typically on windows) when giving the table name in uppercase. @item Fixed that @code{-O lower_case_table_names=1} also converts database names to lower case. @item Fixed unlikely core dump with @code{SELECT ... ORDER BY ... LIMIT}. @item Changed @code{AND/OR} to report that they can return NULL. This fixes a
sql/lock.cc +2 −2 Original line number Diff line number Diff line Loading @@ -419,7 +419,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) uint key_length; DBUG_ENTER("lock_table_name"); key_length=(uint) (strmov(strmov(key,table_list->db)+1,table_list->name) key_length=(uint) (strmov(strmov(key,table_list->db)+1,table_list->real_name) -key)+ 1; /* Only insert the table if we haven't insert it already */ Loading Loading @@ -447,7 +447,7 @@ int lock_table_name(THD *thd, TABLE_LIST *table_list) my_free((gptr) table,MYF(0)); DBUG_RETURN(-1); } if (remove_table_from_cache(thd, table_list->db, table_list->name)) if (remove_table_from_cache(thd, table_list->db, table_list->real_name)) DBUG_RETURN(1); // Table is in use DBUG_RETURN(0); } Loading
sql/slave.cc +2 −2 Original line number Diff line number Diff line Loading @@ -399,7 +399,7 @@ static int create_table_from_dump(THD* thd, NET* net, const char* db, bzero((char*) &tables,sizeof(tables)); tables.db = (char*)db; tables.name = tables.real_name = (char*)table_name; tables.alias= tables.real_name= (char*)table_name; tables.lock_type = TL_WRITE; thd->proc_info = "Opening master dump table"; if (!open_ltable(thd, &tables, TL_WRITE)) Loading Loading @@ -1073,7 +1073,7 @@ static int exec_event(THD* thd, NET* net, MASTER_INFO* mi, int event_len) TABLE_LIST tables; bzero((char*) &tables,sizeof(tables)); tables.db = thd->db; tables.name = tables.real_name = (char*)lev->table_name; tables.alias= tables.real_name= (char*)lev->table_name; tables.lock_type = TL_WRITE; // the table will be opened in mysql_load if(table_rules_on && !tables_ok(thd, &tables)) Loading
sql/sql_acl.cc +37 −27 Original line number Diff line number Diff line Loading @@ -130,9 +130,9 @@ int acl_init(bool dont_read_acl_tables) thd->open_tables=0; thd->db=my_strdup("mysql",MYF(0)); bzero((char*) &tables,sizeof(tables)); tables[0].name=tables[0].real_name=(char*) "host"; tables[1].name=tables[1].real_name=(char*) "user"; tables[2].name=tables[2].real_name=(char*) "db"; tables[0].alias=tables[0].real_name=(char*) "host"; tables[1].alias=tables[1].real_name=(char*) "user"; tables[2].alias=tables[2].real_name=(char*) "db"; tables[0].next=tables+1; tables[1].next=tables+2; tables[0].lock_type=tables[1].lock_type=tables[2].lock_type=TL_READ; Loading Loading @@ -922,7 +922,7 @@ static bool update_user_table(THD *thd, const char *host, const char *user, DBUG_PRINT("enter",("user: %s host: %s",user,host)); bzero((char*) &tables,sizeof(tables)); tables.name=tables.real_name=(char*) "user"; tables.alias=tables.real_name=(char*) "user"; tables.db=(char*) "mysql"; if (!(table=open_ltable(thd,&tables,TL_WRITE))) DBUG_RETURN(1); /* purecov: deadcode */ Loading Loading @@ -1653,7 +1653,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, check->column.length(),0,0)) { my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR),MYF(0), check->column.c_ptr(),table_list->name); check->column.c_ptr(),table_list->alias); DBUG_RETURN(-1); } column_priv |= check->rights | (rights & COL_ACLS); Loading @@ -1664,11 +1664,11 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, { char buf[FN_REFLEN]; sprintf(buf,"%s/%s/%s.frm",mysql_data_home,table_list->db, table_list->name); table_list->real_name); fn_format(buf,buf,"","",4+16+32); if (access(buf,F_OK)) { my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db,table_list->name); my_error(ER_NO_SUCH_TABLE,MYF(0),table_list->db,table_list->real_name); DBUG_RETURN(-1); } } Loading @@ -1676,9 +1676,9 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, /* open the mysql.tables_priv and mysql.columns_priv tables */ bzero((char*) &tables,sizeof(tables)); tables[0].name=tables[0].real_name= (char*) "user"; tables[1].name=tables[1].real_name= (char*) "tables_priv"; tables[2].name=tables[2].real_name= (char*) "columns_priv"; tables[0].alias=tables[0].real_name= (char*) "user"; tables[1].alias=tables[1].real_name= (char*) "tables_priv"; tables[2].alias=tables[2].real_name= (char*) "columns_priv"; tables[0].next=tables+1; /* Don't open column table if we don't need it ! */ tables[1].next=((column_priv || Loading @@ -1702,6 +1702,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, while ((Str = str_list++)) { int error; GRANT_TABLE *grant_table; if (!Str->host.str) { Loading @@ -1716,11 +1717,14 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, continue; } /* Create user if needed */ if (replace_user_table(tables[0].table, pthread_mutex_lock(&acl_cache->lock); error=replace_user_table(tables[0].table, *Str, 0, revoke_grant ? 'N' : 'Y', create_new_users)) create_new_users); pthread_mutex_unlock(&acl_cache->lock); if (error) { result= -1; // Remember error continue; // Add next user Loading @@ -1729,20 +1733,20 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, /* Find/create cached table grant */ grant_table= table_hash_search(Str->host.str,NullS,table_list->db, Str->user.str, table_list->name,1); table_list->real_name,1); if (!grant_table) { if (revoke_grant) { my_printf_error(ER_NONEXISTING_TABLE_GRANT, ER(ER_NONEXISTING_TABLE_GRANT),MYF(0), Str->user.str, Str->host.str,table_list->name); Str->user.str, Str->host.str, table_list->real_name); result= -1; continue; } grant_table = new GRANT_TABLE (Str->host.str,table_list->db, Str->user.str, table_list->name, table_list->real_name, rights, column_priv); if (!grant_table) // end of memory Loading Loading @@ -1789,7 +1793,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, if (replace_table_table(thd,grant_table,tables[1].table,*Str, table_list->db, table_list->name, table_list->real_name, rights, column_priv, revoke_grant)) { // Crashend table ?? result= -1; /* purecov: deadcode */ Loading @@ -1799,7 +1803,7 @@ int mysql_table_grant (THD *thd, TABLE_LIST *table_list, if ((replace_column_table(grant_table,tables[2].table, *Str, columns, table_list->db, table_list->name, table_list->real_name, rights, revoke_grant))) { result= -1; Loading Loading @@ -1836,8 +1840,8 @@ int mysql_grant (THD *thd, const char *db, List <LEX_USER> &list, uint rights, /* open the mysql.user and mysql.db tables */ tables[0].name=tables[0].real_name=(char*) "user"; tables[1].name=tables[1].real_name=(char*) "db"; tables[0].alias=tables[0].real_name=(char*) "user"; tables[1].alias=tables[1].real_name=(char*) "db"; tables[0].next=tables+1; tables[1].next=0; tables[0].lock_type=tables[1].lock_type=TL_WRITE; Loading Loading @@ -1930,8 +1934,8 @@ int grant_init (void) thd->open_tables=0; thd->db=my_strdup("mysql",MYF(0)); bzero((char*) &tables,sizeof(tables)); tables[0].name=tables[0].real_name= (char*) "tables_priv"; tables[1].name=tables[1].real_name= (char*) "columns_priv"; tables[0].alias=tables[0].real_name= (char*) "tables_priv"; tables[1].alias=tables[1].real_name= (char*) "columns_priv"; tables[0].next=tables+1; tables[0].lock_type=tables[1].lock_type=TL_READ; tables[0].db=tables[1].db=thd->db; Loading Loading @@ -2270,6 +2274,7 @@ bool check_grant_db(THD *thd,const char *db) uint get_table_grant(THD *thd, TABLE_LIST *table) { uint privilege; char *user = thd->priv_user; const char *db = table->db ? table->db : thd->db; GRANT_TABLE *grant_table; Loading @@ -2281,8 +2286,9 @@ uint get_table_grant(THD *thd, TABLE_LIST *table) table->grant.version=grant_version; if (grant_table) table->grant.privilege|= grant_table->privs; privilege= table->grant.privilege; pthread_mutex_unlock(&LOCK_grant); return table->grant.privilege; return privilege; } Loading Loading @@ -2335,7 +2341,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) int error = 0; ACL_USER *acl_user; ACL_DB *acl_db; char buff[1024]; DBUG_ENTER("mysql_grant"); DBUG_ENTER("mysql_show_grants"); LINT_INIT(acl_user); if (!initialized) Loading Loading @@ -2384,6 +2390,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) if (send_fields(thd,field_list,1)) DBUG_RETURN(-1); pthread_mutex_lock(&LOCK_grant); VOID(pthread_mutex_lock(&acl_cache->lock)); /* Add first global access grants */ Loading Loading @@ -2578,13 +2585,16 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user) thd->packet.length())) { error=-1; goto end; break; } } } } end: VOID(pthread_mutex_unlock(&acl_cache->lock)); pthread_mutex_unlock(&LOCK_grant); send_eof(&thd->net); DBUG_RETURN(error); } Loading
sql/sql_base.cc +8 −8 Original line number Diff line number Diff line Loading @@ -354,7 +354,7 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh, bool found=0; for (TABLE_LIST *table=tables ; table ; table=table->next) { if (remove_table_from_cache(thd, table->db, table->name, 1)) if (remove_table_from_cache(thd, table->db, table->real_name, 1)) found=1; } if (!found) Loading Loading @@ -715,7 +715,7 @@ TABLE *reopen_name_locked_table(THD* thd, TABLE_LIST* table_list) DBUG_RETURN(0); char* db = thd->db ? thd->db : table_list->db; char* table_name = table_list->name; char* table_name = table_list->real_name; char key[MAX_DBKEY_LENGTH]; uint key_length; key_length=(uint) (strmov(strmov(key,db)+1,table_name)-key)+1; Loading Loading @@ -1285,7 +1285,7 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db, TABLE_LIST table_list; table_list.db=(char*) db; table_list.name=(char*) name; table_list.real_name=(char*) name; table_list.next=0; if ((error=lock_table_name(thd,&table_list))) { Loading Loading @@ -1356,7 +1356,7 @@ int open_tables(THD *thd,TABLE_LIST *start) !(tables->table=open_table(thd, tables->db ? tables->db : thd->db, tables->real_name, tables->name, &refresh))) tables->alias, &refresh))) { if (refresh) // Refresh in progress { Loading Loading @@ -1412,7 +1412,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type) thd->proc_info="Opening table"; while (!(table=open_table(thd,table_list->db ? table_list->db : thd->db, table_list->real_name,table_list->name, table_list->real_name, table_list->alias, &refresh)) && refresh) ; if (table) { Loading Loading @@ -1440,7 +1440,7 @@ TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type lock_type) { my_printf_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, ER(ER_TABLE_NOT_LOCKED_FOR_WRITE), MYF(0),table_list->name); MYF(0),table_list->alias); table=0; } else if ((error=table->file->start_stmt(thd))) Loading Loading @@ -1642,7 +1642,7 @@ find_field_in_tables(THD *thd,Item_field *item,TABLE_LIST *tables) bool found_table=0; for (; tables ; tables=tables->next) { if (!strcmp(tables->name,table_name) && if (!strcmp(tables->alias,table_name) && (!db || (tables->db && !strcmp(db,tables->db)) || (!tables->db && !strcmp(db,thd->db)))) Loading Loading @@ -1882,7 +1882,7 @@ insert_fields(THD *thd,TABLE_LIST *tables, const char *db_name, if (grant_option && !thd->master_access && check_grant_all_columns(thd,SELECT_ACL,table) ) DBUG_RETURN(-1); if (!table_name || (!strcmp(table_name,tables->name) && if (!table_name || (!strcmp(table_name,tables->alias) && (!db_name || !tables->db || !strcmp(tables->db,db_name)))) { Loading