mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 12:32:27 +01:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.1-runtime
into mysql.com:/Users/davi/mysql/mysql-5.1-runtime mysql-test/r/view.result: Auto merged mysql-test/t/view.test: Auto merged sql/sql_view.cc: Auto merged
This commit is contained in:
commit
25ac83c0a9
5 changed files with 40 additions and 12 deletions
|
@ -3720,6 +3720,16 @@ DROP VIEW v1;
|
|||
|
||||
# -- End of test case for Bug#32538.
|
||||
|
||||
drop view if exists a;
|
||||
drop procedure if exists p;
|
||||
create procedure p()
|
||||
begin
|
||||
declare continue handler for sqlexception begin end;
|
||||
create view a as select 1;
|
||||
end|
|
||||
call p();
|
||||
call p();
|
||||
drop procedure p;
|
||||
# -----------------------------------------------------------------
|
||||
# -- Bug#34337: Server crash when Altering a view using a table name.
|
||||
# -----------------------------------------------------------------
|
||||
|
|
|
@ -3601,6 +3601,26 @@ DROP VIEW v1;
|
|||
--echo # -- End of test case for Bug#32538.
|
||||
--echo
|
||||
|
||||
#
|
||||
# Bug#34587 Creating a view inside a stored procedure leads to a server crash
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop view if exists a;
|
||||
drop procedure if exists p;
|
||||
--enable_warnings
|
||||
|
||||
delimiter |;
|
||||
create procedure p()
|
||||
begin
|
||||
declare continue handler for sqlexception begin end;
|
||||
create view a as select 1;
|
||||
end|
|
||||
delimiter ;|
|
||||
call p();
|
||||
call p();
|
||||
drop procedure p;
|
||||
|
||||
###########################################################################
|
||||
|
||||
--echo # -----------------------------------------------------------------
|
||||
|
|
|
@ -1513,10 +1513,8 @@ typedef struct st_lex : public Query_tables_list
|
|||
/* store original leaf_tables for INSERT SELECT and PS/SP */
|
||||
TABLE_LIST *leaf_tables_insert;
|
||||
|
||||
/** Start of SELECT of CREATE VIEW statement */
|
||||
const char* create_view_select_start;
|
||||
/** End of SELECT of CREATE VIEW statement */
|
||||
const char* create_view_select_end;
|
||||
/** SELECT of CREATE VIEW statement */
|
||||
LEX_STRING create_view_select;
|
||||
|
||||
/** Start of 'ON table', in trigger statements. */
|
||||
const char* raw_trg_on_table_name_begin;
|
||||
|
|
|
@ -260,7 +260,7 @@ bool mysql_create_view(THD *thd, TABLE_LIST *views,
|
|||
|
||||
/* This is ensured in the parser. */
|
||||
DBUG_ASSERT(!lex->proc_list.first && !lex->result &&
|
||||
!lex->param_list.elements && !lex->derived_tables);
|
||||
!lex->param_list.elements);
|
||||
|
||||
if (mode != VIEW_CREATE_NEW)
|
||||
{
|
||||
|
@ -741,11 +741,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
|
|||
/* fill structure */
|
||||
view->select_stmt.str= view_query.c_ptr_safe();
|
||||
view->select_stmt.length= view_query.length();
|
||||
|
||||
view->source.str= (char*) thd->lex->create_view_select_start;
|
||||
view->source.length= (thd->lex->create_view_select_end
|
||||
- thd->lex->create_view_select_start);
|
||||
trim_whitespace(thd->charset(), & view->source);
|
||||
view->source= thd->lex->create_view_select;
|
||||
|
||||
view->file_version= 1;
|
||||
view->calc_md5(md5);
|
||||
|
|
|
@ -12056,18 +12056,22 @@ view_select:
|
|||
lex->parsing_options.allows_select_into= FALSE;
|
||||
lex->parsing_options.allows_select_procedure= FALSE;
|
||||
lex->parsing_options.allows_derived= FALSE;
|
||||
lex->create_view_select_start= lip->get_cpp_ptr();
|
||||
lex->create_view_select.str= (char *) lip->get_cpp_ptr();
|
||||
}
|
||||
view_select_aux view_check_option
|
||||
{
|
||||
THD *thd= YYTHD;
|
||||
LEX *lex= Lex;
|
||||
Lex_input_stream *lip= thd->m_lip;
|
||||
uint len= lip->get_cpp_ptr() - lex->create_view_select.str;
|
||||
void *create_view_select= thd->memdup(lex->create_view_select.str, len);
|
||||
lex->create_view_select.length= len;
|
||||
lex->create_view_select.str= (char *) create_view_select;
|
||||
trim_whitespace(thd->charset(), &lex->create_view_select);
|
||||
lex->parsing_options.allows_variable= TRUE;
|
||||
lex->parsing_options.allows_select_into= TRUE;
|
||||
lex->parsing_options.allows_select_procedure= TRUE;
|
||||
lex->parsing_options.allows_derived= TRUE;
|
||||
lex->create_view_select_end= lip->get_cpp_ptr();
|
||||
}
|
||||
;
|
||||
|
||||
|
|
Loading…
Reference in a new issue