From: Date: February 20 2008 3:45pm Subject: Re: bk commit into 5.1 tree (davi:1.2552) BUG#34587 List-Archive: http://lists.mysql.com/commits/42662 Message-Id: <20080220144509.GA6206@dipika> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii * Davi Arnaut [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