mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
fixed SP variables detecting (BUG#4604)
fixed error handling mysql-test/r/view.result: SP variables inside view test mysql-test/t/view.test: SP variables inside view test sql/sql_base.cc: fixed error messages handling sql/sql_yacc.yy: fixed SP variables detecting
This commit is contained in:
@@ -977,3 +977,9 @@ ERROR HY000: View 'test.v1' references invalid table(s) or column(s)
|
|||||||
drop view v1;
|
drop view v1;
|
||||||
create view v1 (a,a) as select 'a','a';
|
create view v1 (a,a) as select 'a','a';
|
||||||
ERROR 42S21: Duplicate column name 'a'
|
ERROR 42S21: Duplicate column name 'a'
|
||||||
|
create procedure p11 () begin declare v int; create view v1 as select v; end;//
|
||||||
|
Warnings:
|
||||||
|
Warning 1310 Referring to uninitialized variable v
|
||||||
|
call p11();
|
||||||
|
ERROR HY000: View's SELECT contains a variable or parameter
|
||||||
|
drop procedure p11;
|
||||||
|
@@ -900,3 +900,13 @@ drop view v1;
|
|||||||
#
|
#
|
||||||
-- error 1060
|
-- error 1060
|
||||||
create view v1 (a,a) as select 'a','a';
|
create view v1 (a,a) as select 'a','a';
|
||||||
|
|
||||||
|
#
|
||||||
|
# SP variables inside view test
|
||||||
|
#
|
||||||
|
delimiter //;
|
||||||
|
create procedure p11 () begin declare v int; create view v1 as select v; end;//
|
||||||
|
delimiter ;//
|
||||||
|
-- error 1350
|
||||||
|
call p11();
|
||||||
|
drop procedure p11;
|
||||||
|
@@ -1760,7 +1760,7 @@ int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
|
|||||||
DBUG_ENTER("open_and_lock_tables");
|
DBUG_ENTER("open_and_lock_tables");
|
||||||
uint counter;
|
uint counter;
|
||||||
if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter))
|
if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter))
|
||||||
DBUG_RETURN(-1); /* purecov: inspected */
|
DBUG_RETURN(thd->net.report_error ? -1 : 1); /* purecov: inspected */
|
||||||
DBUG_RETURN(mysql_handle_derived(thd->lex));
|
DBUG_RETURN(mysql_handle_derived(thd->lex));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1987,7 +1987,8 @@ sp_elseifs:
|
|||||||
sp_case:
|
sp_case:
|
||||||
expr THEN_SYM
|
expr THEN_SYM
|
||||||
{
|
{
|
||||||
sp_head *sp= Lex->sphead;
|
LEX *lex= Lex;
|
||||||
|
sp_head *sp= lex->sphead;
|
||||||
sp_pcontext *ctx= Lex->spcont;
|
sp_pcontext *ctx= Lex->spcont;
|
||||||
uint ip= sp->instructions();
|
uint ip= sp->instructions();
|
||||||
sp_instr_jump_if_not *i;
|
sp_instr_jump_if_not *i;
|
||||||
@@ -2005,6 +2006,7 @@ sp_case:
|
|||||||
Item *expr= new Item_func_eq(var, $1);
|
Item *expr= new Item_func_eq(var, $1);
|
||||||
|
|
||||||
i= new sp_instr_jump_if_not(ip, expr);
|
i= new sp_instr_jump_if_not(ip, expr);
|
||||||
|
lex->variables_used= 1;
|
||||||
}
|
}
|
||||||
sp->push_backpatch(i, ctx->push_label((char *)"", 0));
|
sp->push_backpatch(i, ctx->push_label((char *)"", 0));
|
||||||
sp->add_instr(i);
|
sp->add_instr(i);
|
||||||
@@ -6170,6 +6172,7 @@ simple_ident:
|
|||||||
$1.str);
|
$1.str);
|
||||||
}
|
}
|
||||||
$$ = (Item*) new Item_splocal($1, spv->offset);
|
$$ = (Item*) new Item_splocal($1, spv->offset);
|
||||||
|
lex->variables_used= 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user