1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-18896 Crash in convert_join_subqueries_to_semijoins : Correction

This patch complements the original patch for MDEV-18896 that prevents
conversions to semi-joins in tableless selects used in INSERT statements
in post-5.5 versions of the server.
The test case was corrected as well to ensure that potential conversion
to jtbm semi-joins is also checked (the problem was that one of
the preceeding testcases in subselect_sj.test did not restore the
state of the optimizer switch leaving the 'materialization' in the state
'off' and so blocking this check).
Noticed an inconsistency in the state of select_lex::table_list used
in INSERT statements and left a comment about this.
This commit is contained in:
Igor Babaev
2019-05-19 11:44:34 -07:00
parent 5543b75550
commit 2c9844a438
5 changed files with 12 additions and 1 deletions

View File

@ -3034,6 +3034,13 @@ end_with_restore_list:
*/
/* Skip first table, which is the table we are inserting in */
TABLE_LIST *second_table= first_table->next_local;
/*
This is a hack: this leaves select_lex->table_list in an inconsistent
state as 'elements' does not contain number of elements in the list.
Moreover, if second_table == NULL then 'next' becomes invalid.
TODO: fix it by removing the front element (restoring of it should
be done properly as well)
*/
select_lex->table_list.first= second_table;
select_lex->context.table_list=
select_lex->context.first_name_resolution_table= second_table;