Commit 14ab9bef authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into  bodhi.local:/opt/local/work/mysql-5.0-runtime


sql/field.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
mysql-test/r/sp.result:
  SCCS merged
mysql-test/t/sp.test:
  SCCS merged
parents 6d93f150 cfcd27b3
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1357,4 +1357,13 @@ do { doubleget_union _tmp; \
#define NO_EMBEDDED_ACCESS_CHECKS
#endif


/* Length of decimal number represented by INT32. */

#define MY_INT32_NUM_DECIMAL_DIGITS 11

/* Length of decimal number represented by INT64. */

#define MY_INT64_NUM_DECIMAL_DIGITS 21

#endif /* my_global_h */
+52 −0
Original line number Diff line number Diff line
@@ -1400,3 +1400,55 @@ drop table table_25345_b;
drop procedure proc_25345;
drop function func_25345;
drop function func_25345_b;
create procedure proc_26503_error_1()
begin
retry:
repeat
begin
declare continue handler for sqlexception
begin
iterate retry;
end
select "do something";
end
until true end repeat retry;
end//
ERROR 42000: ITERATE with no matching label: retry
create procedure proc_26503_error_2()
begin
retry:
repeat
begin
declare continue handler for sqlexception
iterate retry;
select "do something";
end
until true end repeat retry;
end//
ERROR 42000: ITERATE with no matching label: retry
create procedure proc_26503_error_3()
begin
retry:
repeat
begin
declare continue handler for sqlexception
begin
leave retry;
end
select "do something";
end
until true end repeat retry;
end//
ERROR 42000: LEAVE with no matching label: retry
create procedure proc_26503_error_4()
begin
retry:
repeat
begin
declare continue handler for sqlexception
leave retry;
select "do something";
end
until true end repeat retry;
end//
ERROR 42000: LEAVE with no matching label: retry
+191 −0
Original line number Diff line number Diff line
@@ -5633,6 +5633,32 @@ call proc_bug19733()|
call proc_bug19733()|
drop procedure proc_bug19733|
drop table t3|
DROP PROCEDURE IF EXISTS p1|
DROP VIEW IF EXISTS v1, v2|
DROP TABLE IF EXISTS t3, t4|
CREATE TABLE t3 (t3_id INT)|
INSERT INTO t3 VALUES (0)|
INSERT INTO t3 VALUES (1)|
CREATE TABLE t4 (t4_id INT)|
INSERT INTO t4 VALUES (2)|
CREATE VIEW v1 AS
SELECT t3.t3_id, t4.t4_id
FROM t3 JOIN t4 ON t3.t3_id = 0|
CREATE VIEW v2 AS
SELECT t3.t3_id AS t3_id_1, v1.t3_id AS t3_id_2, v1.t4_id
FROM t3 LEFT JOIN v1 ON t3.t3_id = 0|
CREATE PROCEDURE p1() SELECT * FROM v2|
CALL p1()|
t3_id_1	t3_id_2	t4_id
0	0	2
1	NULL	NULL
CALL p1()|
t3_id_1	t3_id_2	t4_id
0	0	2
1	NULL	NULL
DROP PROCEDURE p1|
DROP VIEW v1, v2|
DROP TABLE t3, t4|
End of 5.0 tests
DROP TABLE IF EXISTS bug23760|
DROP TABLE IF EXISTS bug23760_log|
@@ -5765,6 +5791,171 @@ func_8407_b()
1500
drop function func_8407_a|
drop function func_8407_b|
drop table if exists table_26503|
drop procedure if exists proc_26503_ok_1|
drop procedure if exists proc_26503_ok_2|
drop procedure if exists proc_26503_ok_3|
drop procedure if exists proc_26503_ok_4|
create table table_26503(a int unique)|
create procedure proc_26503_ok_1(v int)
begin
declare i int default 5;
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
iterate retry;
select 'dead code';
end;
end while retry;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end|
create procedure proc_26503_ok_2(v int)
begin
declare i int default 5;
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
leave retry;
select 'dead code';
end;
end while;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end|
create procedure proc_26503_ok_3(v int)
begin
declare i int default 5;
retry:
begin
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
iterate retry;
select 'dead code';
end;
end while retry;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end;
end|
create procedure proc_26503_ok_4(v int)
begin
declare i int default 5;
retry:
begin
declare continue handler for sqlexception
begin
select 'caught something';
retry:
while i > 0 do
begin
set i = i - 1;
select 'looping', i;
leave retry;
select 'dead code';
end;
end while;
select 'leaving handler';
end;
select 'do something';
insert into table_26503 values (v);
select 'do something again';
insert into table_26503 values (v);
end;
end|
call proc_26503_ok_1(1)|
do something
do something
do something again
do something again
caught something
caught something
looping	i
looping	4
looping	i
looping	3
looping	i
looping	2
looping	i
looping	1
looping	i
looping	0
leaving handler
leaving handler
call proc_26503_ok_2(2)|
do something
do something
do something again
do something again
caught something
caught something
looping	i
looping	4
leaving handler
leaving handler
call proc_26503_ok_3(3)|
do something
do something
do something again
do something again
caught something
caught something
looping	i
looping	4
looping	i
looping	3
looping	i
looping	2
looping	i
looping	1
looping	i
looping	0
leaving handler
leaving handler
call proc_26503_ok_4(4)|
do something
do something
do something again
do something again
caught something
caught something
looping	i
looping	4
leaving handler
leaving handler
drop table table_26503|
drop procedure proc_26503_ok_1|
drop procedure proc_26503_ok_2|
drop procedure proc_26503_ok_3|
drop procedure proc_26503_ok_4|
DROP FUNCTION IF EXISTS bug25373|
CREATE FUNCTION bug25373(p1 INTEGER) RETURNS INTEGER
LANGUAGE SQL DETERMINISTIC
+68 −0
Original line number Diff line number Diff line
@@ -2021,6 +2021,74 @@ drop procedure proc_25345;
drop function func_25345;
drop function func_25345_b;

#
# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
#

delimiter //;

--error ER_SP_LILABEL_MISMATCH
create procedure proc_26503_error_1()
begin
retry:
  repeat
    begin
      declare continue handler for sqlexception
      begin
        iterate retry;
      end

      select "do something";
    end
  until true end repeat retry;
end//

--error ER_SP_LILABEL_MISMATCH
create procedure proc_26503_error_2()
begin
retry:
  repeat
    begin
      declare continue handler for sqlexception
        iterate retry;

      select "do something";
    end
  until true end repeat retry;
end//

--error ER_SP_LILABEL_MISMATCH
create procedure proc_26503_error_3()
begin
retry:
  repeat
    begin
      declare continue handler for sqlexception
      begin
        leave retry;
      end

      select "do something";
    end
  until true end repeat retry;
end//

--error ER_SP_LILABEL_MISMATCH
create procedure proc_26503_error_4()
begin
retry:
  repeat
    begin
      declare continue handler for sqlexception
        leave retry;

      select "do something";
    end
  until true end repeat retry;
end//

delimiter ;//

#
# BUG#NNNN: New bug synopsis
#
+176 −0
Original line number Diff line number Diff line
@@ -6592,6 +6592,47 @@ call proc_bug19733()|
drop procedure proc_bug19733|
drop table t3|


#
# BUG#20492: Subsequent calls to stored procedure yeild incorrect
# result if join is used 
#
# Optimized ON expression in join wasn't properly saved for reuse.
#
--disable_warnings
DROP PROCEDURE IF EXISTS p1|
DROP VIEW IF EXISTS v1, v2|
DROP TABLE IF EXISTS t3, t4|
--enable_warnings

CREATE TABLE t3 (t3_id INT)|

INSERT INTO t3 VALUES (0)|
INSERT INTO t3 VALUES (1)|

CREATE TABLE t4 (t4_id INT)|

INSERT INTO t4 VALUES (2)|

CREATE VIEW v1 AS
SELECT t3.t3_id, t4.t4_id
FROM t3 JOIN t4 ON t3.t3_id = 0|

CREATE VIEW v2 AS
SELECT t3.t3_id AS t3_id_1, v1.t3_id AS t3_id_2, v1.t4_id
FROM t3 LEFT JOIN v1 ON t3.t3_id = 0|

CREATE PROCEDURE p1() SELECT * FROM v2|

# Results should not differ.
CALL p1()|
CALL p1()|

DROP PROCEDURE p1|
DROP VIEW v1, v2|
DROP TABLE t3, t4|


--echo End of 5.0 tests


@@ -6738,6 +6779,141 @@ select func_8407_b()|
drop function func_8407_a|
drop function func_8407_b|

#
# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
#

--disable_warnings
drop table if exists table_26503|
drop procedure if exists proc_26503_ok_1|
drop procedure if exists proc_26503_ok_2|
drop procedure if exists proc_26503_ok_3|
drop procedure if exists proc_26503_ok_4|
--enable_warnings

create table table_26503(a int unique)|

create procedure proc_26503_ok_1(v int)
begin
  declare i int default 5;

  declare continue handler for sqlexception
  begin
    select 'caught something';
    retry:
    while i > 0 do
      begin
        set i = i - 1;
        select 'looping', i;
        iterate retry;
        select 'dead code';
      end;
    end while retry;
    select 'leaving handler';
  end;

  select 'do something';
  insert into table_26503 values (v);
  select 'do something again';
  insert into table_26503 values (v);
end|

create procedure proc_26503_ok_2(v int)
begin
  declare i int default 5;

  declare continue handler for sqlexception
  begin
    select 'caught something';
    retry:
    while i > 0 do
      begin
        set i = i - 1;
        select 'looping', i;
        leave retry;
        select 'dead code';
      end;
    end while;
    select 'leaving handler';
  end;

  select 'do something';
  insert into table_26503 values (v);
  select 'do something again';
  insert into table_26503 values (v);
end|

## The outer retry label should not prevent using the inner label.

create procedure proc_26503_ok_3(v int)
begin
  declare i int default 5;

retry:
  begin
    declare continue handler for sqlexception
    begin
      select 'caught something';
      retry:
      while i > 0 do
        begin
          set i = i - 1;
          select 'looping', i;
          iterate retry;
          select 'dead code';
        end;
      end while retry;
      select 'leaving handler';
    end;

    select 'do something';
    insert into table_26503 values (v);
    select 'do something again';
    insert into table_26503 values (v);
  end;
end|

## The outer retry label should not prevent using the inner label.

create procedure proc_26503_ok_4(v int)
begin
  declare i int default 5;

retry:
  begin
    declare continue handler for sqlexception
    begin
      select 'caught something';
      retry:
      while i > 0 do
        begin
          set i = i - 1;
          select 'looping', i;
          leave retry;
          select 'dead code';
        end;
      end while;
      select 'leaving handler';
    end;

    select 'do something';
    insert into table_26503 values (v);
    select 'do something again';
    insert into table_26503 values (v);
  end;
end|

call proc_26503_ok_1(1)|
call proc_26503_ok_2(2)|
call proc_26503_ok_3(3)|
call proc_26503_ok_4(4)|

drop table table_26503|
drop procedure proc_26503_ok_1|
drop procedure proc_26503_ok_2|
drop procedure proc_26503_ok_3|
drop procedure proc_26503_ok_4|

#
# Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
#            result.
Loading