mirror of
https://github.com/MariaDB/server.git
synced 2025-08-29 00:08:14 +03:00
BUG#5390 - problems with merge tables
Problem #1: INSERT...SELECT, Version for 4.1. INSERT ... SELECT with the same table on both sides (hidden below a MERGE table) does now work by buffering the select result. The duplicate detection works now after open_and_lock_tables() on the locks. I did not find a test case that failed without the change in sql_update.cc. I made the change anyway as it should in theory fix a possible MERGE table problem with multi-table update.
This commit is contained in:
@@ -2897,16 +2897,17 @@ unsent_create_error:
|
||||
if (unit->select_limit_cnt < select_lex->select_limit)
|
||||
unit->select_limit_cnt= HA_POS_ERROR; // No limit
|
||||
|
||||
if (find_real_table_in_list(tables->next, tables->db, tables->real_name))
|
||||
if ((res= open_and_lock_tables(thd, tables)))
|
||||
break;
|
||||
|
||||
insert_table= tables->table;
|
||||
/* MERGE sub-tables can only be detected after open. */
|
||||
if (mysql_lock_have_duplicate(thd, insert_table, tables->next))
|
||||
{
|
||||
/* Using same table for INSERT and SELECT */
|
||||
select_lex->options |= OPTION_BUFFER_RESULT;
|
||||
}
|
||||
|
||||
if ((res= open_and_lock_tables(thd, tables)))
|
||||
break;
|
||||
|
||||
insert_table= tables->table;
|
||||
/* Skip first table, which is the table we are inserting in */
|
||||
select_lex->table_list.first= (byte*) first_local_table->next;
|
||||
tables= (TABLE_LIST *) select_lex->table_list.first;
|
||||
|
Reference in New Issue
Block a user