mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +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:
@ -1647,7 +1647,7 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list,
|
||||
table_list,
|
||||
thd->lex->first_select_lex()->leaf_tables,
|
||||
select_insert, INSERT_ACL, SELECT_ACL,
|
||||
true, true))
|
||||
true))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
if (insert_into_view && !fields.elements)
|
||||
|
Reference in New Issue
Block a user