Commit 0708859b authored by unknown's avatar unknown
Browse files

Merge weblab.(none):/home/marcsql/TREE/mysql-5.0-8407_b

into  weblab.(none):/home/marcsql/TREE/mysql-5.1-8407-merge


mysql-test/r/information_schema_db.result:
  Auto merged
mysql-test/r/view.result:
  Auto merged
mysql-test/t/sp.test:
  Auto merged
sql/lock.cc:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sp_head.h:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_update.cc:
  Auto merged
sql/table.cc:
  Auto merged
sql/table.h:
  Auto merged
parents c155c66d 266a7fff
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -98,13 +98,13 @@ where table_schema='test';
table_name	table_type	table_comment
t1	BASE TABLE	
v1	VIEW	VIEW
v2	VIEW	View 'test.v2' references invalid table(s) or column(s) or function(s) or define
v2	VIEW	VIEW
drop table t1;
select table_name, table_type, table_comment from information_schema.tables
where table_schema='test';
table_name	table_type	table_comment
v1	VIEW	View 'test.v1' references invalid table(s) or column(s) or function(s) or define
v2	VIEW	View 'test.v2' references invalid table(s) or column(s) or function(s) or define
v1	VIEW	VIEW
v2	VIEW	VIEW
drop function f1;
drop function f2;
drop view v1, v2;
+3 −3
Original line number Diff line number Diff line
@@ -1935,11 +1935,11 @@ create function f1 () returns int return (select max(col1) from t1);
DROP TABLE t1;
CHECK TABLE v1, v2, v3, v4, v5, v6;
Table	Op	Msg_type	Msg_text
test.v1	check	error	View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
test.v1	check	status	OK
test.v2	check	status	OK
test.v3	check	error	View 'test.v3' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
test.v3	check	status	OK
test.v4	check	status	OK
test.v5	check	error	View 'test.v5' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
test.v5	check	status	OK
test.v6	check	status	OK
drop function f1;
drop function f2;
+49 −4
Original line number Diff line number Diff line
@@ -1369,7 +1369,7 @@ end|
select f11()|
--error ER_CANT_REOPEN_TABLE
select f11() from t1|
# We don't handle temporary tables used by nested functions well
# Test that using a single table instance at a time works
create function f12_1() returns int
begin
  drop temporary table if exists t3;
@@ -1379,11 +1379,9 @@ begin
end|
create function f12_2() returns int
  return (select count(*) from t3)|
# We need clean start to get error

drop temporary table t3|
--error ER_NO_SUCH_TABLE
select f12_1()|
--error ER_NO_SUCH_TABLE
select f12_1() from t1 limit 1|

# Cleanup
@@ -6802,6 +6800,53 @@ CALL bug24117()|
DROP PROCEDURE bug24117|
DROP TABLE t3|

#
# Bug#8407(Stored functions/triggers ignore exception handler)
#

--disable_warnings
drop function if exists func_8407_a|
drop function if exists func_8407_b|
--enable_warnings

create function func_8407_a() returns int
begin
  declare x int;

  declare continue handler for sqlexception
  begin
  end;

  select 1 from no_such_view limit 1 into x;

  return x;
end|

create function func_8407_b() returns int
begin
  declare x int default 0;

  declare continue handler for sqlstate '42S02'
  begin
    set x:= x+1000;
  end;

  case (select 1 from no_such_view limit 1)
    when 1 then set x:= x+1;
    when 2 then set x:= x+2;
    else set x:= x+100;
  end case;
  set x:=x + 500;
  
  return x;
end|

select func_8407_a()|
select func_8407_b()|

drop function func_8407_a|
drop function func_8407_b|

#
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
#       at the end of the file!
+1 −1
Original line number Diff line number Diff line
@@ -604,7 +604,7 @@ TABLE_LIST *mysql_lock_have_duplicate(THD *thd, TABLE_LIST *needle,

  for (; haystack; haystack= haystack->next_global)
  {
    if (haystack->placeholder() || haystack->schema_table)
    if (haystack->placeholder())
      continue;
    table2= haystack->table;
    if (table2->s->tmp_table == TMP_TABLE)
+8 −0
Original line number Diff line number Diff line
@@ -2553,6 +2553,14 @@ static int my_message_sql(uint error, const char *str, myf MyFlags)
  */
  if ((thd= current_thd))
  {
    /*
      TODO: There are two exceptions mechanism (THD and sp_rcontext),
      this could be improved by having a common stack of handlers.
    */
    if (thd->handle_error(error,
                          MYSQL_ERROR::WARN_LEVEL_ERROR))
      DBUG_RETURN(0);

    if (thd->spcont &&
        thd->spcont->handle_error(error, MYSQL_ERROR::WARN_LEVEL_ERROR, thd))
    {
Loading