diff options
author | Igor Babaev <igor@askmonty.org> | 2021-03-05 20:18:28 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2021-03-05 20:18:28 -0800 |
commit | c24bcd5948bd69f336af61214c0f31165d19dc14 (patch) | |
tree | 24a449247e4055e4b659af041e32ab7dd467fb5c /sql/sql_lex.h | |
parent | fcc9f8b10cd2f497ff410b592808eedb3ee5f212 (diff) | |
download | mariadb-git-bb-10.4-mdev-22786.tar.gz |
MDEV-22786 Crashes with nested table value constructorsbb-10.4-mdev-22786
The bug caused crashes of the server when processing queries with nested
table value constructors (TVC) . It happened because the grammar rules to
parse TVC used the same global lists for both nested TVC and nesting TVC.
As a result invalid select trees were constructed for queries with nested
TVC and this led to crashes at the prepare stage.
This patch provides its own lists structures for each TVC nest level.
Besides the patch fixes a bug in the function wrap_tvc() that missed
inheritance of the SELECT_LEX::exclude_from_table_unique_test for
selects that wrapped TVCs. This inheritance is critical for specifications
of derived tables that employ nested TVCs.
Approved by dmitry.shulga@mariadb.com
Diffstat (limited to 'sql/sql_lex.h')
-rw-r--r-- | sql/sql_lex.h | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h index d3b316d6a8d..6ef36a2a49f 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1287,6 +1287,8 @@ public: /* it is for correct printing SELECT options */ thr_lock_type lock_type; + List<List_item> save_many_values; + List<Item> *save_insert_list; table_value_constr *tvc; bool in_tvc; @@ -4409,13 +4411,6 @@ public: return false; } - void tvc_start() - { - field_list.empty(); - many_values.empty(); - insert_list= 0; - } - SELECT_LEX_UNIT *alloc_unit(); SELECT_LEX *alloc_select(bool is_select); SELECT_LEX_UNIT *create_unit(SELECT_LEX*); @@ -4470,6 +4465,8 @@ public: bool distinct); SELECT_LEX *parsed_subselect(SELECT_LEX_UNIT *unit); bool parsed_insert_select(SELECT_LEX *firs_select); + void save_values_list_state(); + void restore_values_list_state(); bool parsed_TVC_start(); SELECT_LEX *parsed_TVC_end(); TABLE_LIST *parsed_derived_table(SELECT_LEX_UNIT *unit, |