summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-11-08 03:33:52 +0200
committerunknown <bell@sanja.is.com.ua>2004-11-08 03:33:52 +0200
commitadb6dcb928a8c6f3e6f0ff74db1c02947d86e1c5 (patch)
tree0c6570770793ecbf8b121ecfe61c9f338109ecd1 /sql/sql_base.cc
parentbff1d4751da5e74bd005675b04a8217b163da16b (diff)
parent79a33fa20ce3982b13999cd9a3d4e188d93cb643 (diff)
downloadmariadb-git-adb6dcb928a8c6f3e6f0ff74db1c02947d86e1c5.tar.gz
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-view-5.0 mysql-test/r/view.result: Auto merged mysql-test/t/view.test: Auto merged sql/sql_base.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_update.cc: Auto merged sql/table.h: Auto merged
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc20
1 files changed, 14 insertions, 6 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 959af0067e7..c6e11bc73cc 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -595,7 +595,8 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
{
if ((!strcmp(table->db, db_name) &&
!strcmp(table->real_name, table_name)) ||
- (table->view &&
+ (table->view && // it is VIEW and
+ table->table->table_cache_key && // it is not temporary table
!strcmp(table->table->table_cache_key, db_name) &&
!strcmp(table->table->table_name, table_name)))
break;
@@ -620,6 +621,8 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
TABLE_LIST* unique_table(TABLE_LIST *table, TABLE_LIST *table_list)
{
+ DBUG_ENTER("unique_table");
+ DBUG_PRINT("enter", ("table alias: %s", table->alias));
TABLE_LIST *res;
const char *d_name= table->db, *t_name= table->real_name;
char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_NAME];
@@ -646,13 +649,18 @@ TABLE_LIST* unique_table(TABLE_LIST *table, TABLE_LIST *table_list)
return 0;
}
}
- if ((res= find_table_in_global_list(table_list, d_name, t_name)) &&
- res->table && res->table == table->table)
+
+ DBUG_PRINT("info", ("real table: %s.%s", d_name, t_name));
+ for(;;)
{
- // we found entry of this table try again.
- return find_table_in_global_list(res->next_global, d_name, t_name);
+ if (!(res= find_table_in_global_list(table_list, d_name, t_name)) ||
+ !res->table || res->table != table->table)
+ break;
+ /* if we found entry of this table try again. */
+ table_list= res->next_global;
+ DBUG_PRINT("info", ("found same copy of table"));
}
- return res;
+ DBUG_RETURN(res);
}