diff options
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r-- | sql/sql_lex.cc | 29 |
1 files changed, 9 insertions, 20 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 5ffe8c1c365..96a0a86c43d 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1376,28 +1376,17 @@ create_total_list_n_last_return(THD *thd_arg, { TABLE_LIST *cursor; next_table= aux->next; - for (cursor= **result_arg; cursor; cursor= cursor->next) - if (!strcmp(cursor->db, aux->db) && - !strcmp(cursor->real_name, aux->real_name) && - !strcmp(cursor->alias, aux->alias)) - break; - if (!cursor) + /* Add not used table to the total table list */ + if (!(cursor= (TABLE_LIST *) thd->memdup((char*) aux, + sizeof(*aux)))) { - /* Add not used table to the total table list */ - if (!(cursor= (TABLE_LIST *) thd->memdup((char*) aux, - sizeof(*aux)))) - { - send_error(thd,0); - return 1; - } - *new_table_list= cursor; - cursor->table_list= aux; //to be able mark this table as shared - new_table_list= &cursor->next; - *new_table_list= 0; // end result list + send_error(thd,0); + return 1; } - else - // Mark that it's used twice - cursor->table_list->shared= aux->shared= 1; + *new_table_list= cursor; + cursor->table_list= aux; + new_table_list= &cursor->next; + *new_table_list= 0; // end result list aux->table_list= cursor; } } |