mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-36486 Optimizer hints are resolved against the INSERT part of INSERT..SELECT
When processing queries like INSERT INTO t1 (..) SELECT .. FROM t1, t2 ..., there is a single query block (i.e., a single SELECT_LEX) for both INSERT and SELECT parts. During hints resolution, when hints are attached to particular TABLE_LIST's, the search is performed by table name across the whole query block. So, if a table mentioned in an optimizer hint is present in the INSERT part, the hint is attached to the that table. This is obviously wrong as optimizer hints are supposed to only affect the SELECT part of an INSERT..SELECT clause. This commit disables possible attaching hints to tables in the INSERT part and fixes some other bugs related to INSERT..SELECT statements processing
This commit is contained in:
@@ -228,7 +228,7 @@ Item ** find_item_in_list(Item *item, List<Item> &items, uint *counter,
|
||||
bool setup_tables(THD *thd, Name_resolution_context *context,
|
||||
List<TABLE_LIST> *from_clause, TABLE_LIST *tables,
|
||||
List<TABLE_LIST> &leaves, bool select_insert,
|
||||
bool full_table_list, bool resolve_opt_hints);
|
||||
bool full_table_list);
|
||||
bool setup_tables_and_check_access(THD *thd,
|
||||
Name_resolution_context *context,
|
||||
List<TABLE_LIST> *from_clause,
|
||||
@@ -237,8 +237,7 @@ bool setup_tables_and_check_access(THD *thd,
|
||||
bool select_insert,
|
||||
privilege_t want_access_first,
|
||||
privilege_t want_access,
|
||||
bool full_table_list,
|
||||
bool resolve_opt_hints);
|
||||
bool full_table_list);
|
||||
bool wait_while_table_is_used(THD *thd, TABLE *table,
|
||||
enum ha_extra_function function);
|
||||
|
||||
|
Reference in New Issue
Block a user