From 0bd2b802546c09361fe7823624e09bde16c976ac Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 7 May 2018 17:42:55 +0200 Subject: MDEV-15347: Valgrind or ASAN errors in mysql_make_view on query from information_schema Make each lex pointing to statement lex instead of global pointer in THD (no need store and restore the global pointer and put it on SP stack). --- sql/sql_lex.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'sql/sql_lex.h') diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 4fcd090e1f5..3b47b1d25c9 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -730,7 +730,7 @@ public: /* Point to the LEX in which it was created, used in view subquery detection. - TODO: make also st_select_lex::parent_stmt_lex (see THD::stmt_lex) + TODO: make also st_select_lex::parent_stmt_lex (see LEX::stmt_lex) and use st_select_lex::parent_lex & st_select_lex::parent_stmt_lex instead of global (from THD) references where it is possible. */ @@ -2435,6 +2435,21 @@ struct LEX: public Query_tables_list // type information char *length,*dec; CHARSET_INFO *charset; + /* + LEX which represents current statement (conventional, SP or PS) + + For example during view parsing THD::lex will point to the views LEX and + lex::stmt_lex will point to LEX of the statement where the view will be + included + + Currently it is used to have always correct select numbering inside + statement (LEX::current_select_number) without storing and restoring a + global counter which was THD::select_number. + + TODO: make some unified statement representation (now SP has different) + to store such data like LEX::current_select_number. + */ + LEX *stmt_lex; LEX_STRING name; char *help_arg; -- cgit v1.2.1