* Davi Arnaut <davi@stripped> [08/02/15 14:50]:
> ChangeSet@stripped, 2008-02-15 09:40:55-02:00, davi@stripped +5 -0
> Bug#34587 Creating a view inside a stored procedure leads to a server crash
>
> The problem is that when a stored procedure is being parsed for
> the first execution, the body is copied to a temporary buffer
> which is disregarded sometime after the statement is parsed.
> And during this parsing phase, the rule for CREATE VIEW was
> holding a reference to the string being parsed for use during
> the execution of the CREATE VIEW statement, leading to invalid
> memory access later.
>
> The solution is to allocate and copy the SELECT of a CREATE
> VIEW statement using the thread memory root, which is set to
> the permanent arena of the stored procedure.
OK to push.
Please see one item below.
> + view->source.str= thd->lex->create_view_select.str;
> + view->source.length= thd->lex->create_view_select.length;
You could assign by value:
view->source= thd->lex->create_view_select;
--
-- Konstantin Osipov Software Developer, Moscow, Russia
-- MySQL AB, www.mysql.com The best DATABASE COMPANY in the GALAXY