diff options
author | unknown <Sinisa@sinisa.nasamreza.org> | 2004-05-04 23:04:05 +0300 |
---|---|---|
committer | unknown <Sinisa@sinisa.nasamreza.org> | 2004-05-04 23:04:05 +0300 |
commit | 5bd7b50cf1c227af00cdf3fab969ee5a2545f4f4 (patch) | |
tree | ab3b788364417bddf4ae2820a5b6a3f7294f4e57 /sql/sql_update.cc | |
parent | af794dde932c9fcf056c8afcfd00ad3483d237c7 (diff) | |
download | mariadb-git-5bd7b50cf1c227af00cdf3fab969ee5a2545f4f4.tar.gz |
Fix for a multi table updates when one of the tables is not updated
but used in a nested query.
Diffstat (limited to 'sql/sql_update.cc')
-rw-r--r-- | sql/sql_update.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 55ea15f1af4..d985d2c2e78 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -578,7 +578,7 @@ multi_update::multi_update(THD *thd_arg, TABLE_LIST *table_list, int multi_update::prepare(List<Item> ¬_used_values, SELECT_LEX_UNIT *lex_unit) { - TABLE_LIST *table_ref; + TABLE_LIST *table_ref, *tables; SQL_LIST update; table_map tables_to_update= 0; Item_field *item; @@ -604,8 +604,9 @@ int multi_update::prepare(List<Item> ¬_used_values, We have to check values after setup_tables to get used_keys right in reference tables */ + tables= thd->lex->select_lex.get_table_list(); - if (setup_fields(thd, 0, all_tables, *values, 1, 0, 0)) + if (setup_fields(thd, 0, tables, *values, 1, 0, 0)) DBUG_RETURN(1); /* @@ -615,7 +616,7 @@ int multi_update::prepare(List<Item> ¬_used_values, */ update.empty(); - for (table_ref= all_tables; table_ref; table_ref=table_ref->next) + for (table_ref= tables; table_ref; table_ref=table_ref->next) { TABLE *table=table_ref->table; if (tables_to_update & table->map) @@ -684,10 +685,10 @@ int multi_update::prepare(List<Item> ¬_used_values, which will cause an error when reading a row. (This issue is mostly relevent for MyISAM tables) */ - for (table_ref= all_tables; table_ref; table_ref=table_ref->next) + for (table_ref= tables; table_ref; table_ref=table_ref->next) { TABLE *table=table_ref->table; - if (!(tables_to_update & table->map) && + if (!(tables_to_update & table->map) || !table->no_keyread && find_real_table_in_list(update_tables, table_ref->db, table_ref->real_name)) table->no_cache= 1; // Disable row cache |