diff options
author | Igor Babaev <igor@askmonty.org> | 2021-03-03 22:48:39 -0800 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2021-03-03 22:49:29 -0800 |
commit | 08d8bce583227a25b4f646fa9a836f7893badd9a (patch) | |
tree | 9cc6227d699b7ae4e267085663f30bd4b6d4e318 /sql/sql_lex.h | |
parent | 5bd994b0d56d11bf62717a84172c49ca9ed37de4 (diff) | |
download | mariadb-git-08d8bce583227a25b4f646fa9a836f7893badd9a.tar.gz |
MDEV-22786 Crashes with nested table value constructors
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 | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 979e212c1f6..474f3174ac9 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -1176,6 +1176,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; @@ -4046,12 +4048,10 @@ public: return false; } - void tvc_start() - { - field_list.empty(); - many_values.empty(); - insert_list= 0; - } + void save_values_list_state(); + void restore_values_list_state(); + void tvc_start(); + bool tvc_start_derived(); bool tvc_finalize(); bool tvc_finalize_derived(); |