6592
6592
drop procedure proc_bug19733|
6597
# BUG#20492: Subsequent calls to stored procedure yeild incorrect
6598
# result if join is used
6600
# Optimized ON expression in join wasn't properly saved for reuse.
6603
DROP PROCEDURE IF EXISTS p1|
6604
DROP VIEW IF EXISTS v1, v2|
6605
DROP TABLE IF EXISTS t3, t4|
6608
CREATE TABLE t3 (t3_id INT)|
6610
INSERT INTO t3 VALUES (0)|
6611
INSERT INTO t3 VALUES (1)|
6613
CREATE TABLE t4 (t4_id INT)|
6615
INSERT INTO t4 VALUES (2)|
6618
SELECT t3.t3_id, t4.t4_id
6619
FROM t3 JOIN t4 ON t3.t3_id = 0|
6622
SELECT t3.t3_id AS t3_id_1, v1.t3_id AS t3_id_2, v1.t4_id
6623
FROM t3 LEFT JOIN v1 ON t3.t3_id = 0|
6625
CREATE PROCEDURE p1() SELECT * FROM v2|
6627
# Results should not differ.
6595
6636
--echo End of 5.0 tests
6739
6780
drop function func_8407_b|
6783
# Bug#26503 (Illegal SQL exception handler code causes the server to crash)
6787
drop table if exists table_26503|
6788
drop procedure if exists proc_26503_ok_1|
6789
drop procedure if exists proc_26503_ok_2|
6790
drop procedure if exists proc_26503_ok_3|
6791
drop procedure if exists proc_26503_ok_4|
6794
create table table_26503(a int unique)|
6796
create procedure proc_26503_ok_1(v int)
6798
declare i int default 5;
6800
declare continue handler for sqlexception
6802
select 'caught something';
6807
select 'looping', i;
6812
select 'leaving handler';
6815
select 'do something';
6816
insert into table_26503 values (v);
6817
select 'do something again';
6818
insert into table_26503 values (v);
6821
create procedure proc_26503_ok_2(v int)
6823
declare i int default 5;
6825
declare continue handler for sqlexception
6827
select 'caught something';
6832
select 'looping', i;
6837
select 'leaving handler';
6840
select 'do something';
6841
insert into table_26503 values (v);
6842
select 'do something again';
6843
insert into table_26503 values (v);
6846
## The outer retry label should not prevent using the inner label.
6848
create procedure proc_26503_ok_3(v int)
6850
declare i int default 5;
6854
declare continue handler for sqlexception
6856
select 'caught something';
6861
select 'looping', i;
6866
select 'leaving handler';
6869
select 'do something';
6870
insert into table_26503 values (v);
6871
select 'do something again';
6872
insert into table_26503 values (v);
6876
## The outer retry label should not prevent using the inner label.
6878
create procedure proc_26503_ok_4(v int)
6880
declare i int default 5;
6884
declare continue handler for sqlexception
6886
select 'caught something';
6891
select 'looping', i;
6896
select 'leaving handler';
6899
select 'do something';
6900
insert into table_26503 values (v);
6901
select 'do something again';
6902
insert into table_26503 values (v);
6906
call proc_26503_ok_1(1)|
6907
call proc_26503_ok_2(2)|
6908
call proc_26503_ok_3(3)|
6909
call proc_26503_ok_4(4)|
6911
drop table table_26503|
6912
drop procedure proc_26503_ok_1|
6913
drop procedure proc_26503_ok_2|
6914
drop procedure proc_26503_ok_3|
6915
drop procedure proc_26503_ok_4|
6742
6918
# Bug#25373: Stored functions wasn't compared correctly which leads to a wrong
6754
6930
DROP FUNCTION bug25373|
6757
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
6758
# at the end of the file!
6933
# Bug#20777: Function w BIGINT UNSIGNED shows diff. behaviour --ps-protocol
6935
drop function if exists bug20777|
6936
drop table if exists examplebug20777|
6938
create function bug20777(f1 bigint unsigned) returns bigint unsigned
6940
set f1 = (f1 - 10); set f1 = (f1 + 10);
6944
select bug20777(9223372036854775803) as '9223372036854775803 2**63-5';
6945
select bug20777(9223372036854775804) as '9223372036854775804 2**63-4';
6946
select bug20777(9223372036854775805) as '9223372036854775805 2**63-3';
6947
select bug20777(9223372036854775806) as '9223372036854775806 2**63-2';
6948
select bug20777(9223372036854775807) as '9223372036854775807 2**63-1';
6949
select bug20777(9223372036854775808) as '9223372036854775808 2**63+0';
6950
select bug20777(9223372036854775809) as '9223372036854775809 2**63+1';
6951
select bug20777(9223372036854775810) as '9223372036854775810 2**63+2';
6952
select bug20777(-9223372036854775808) as 'lower bounds signed bigint';
6953
select bug20777(9223372036854775807) as 'upper bounds signed bigint';
6954
select bug20777(0) as 'lower bounds unsigned bigint';
6955
select bug20777(18446744073709551615) as 'upper bounds unsigned bigint';
6956
select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
6957
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
6959
create table examplebug20777 as select
6961
bug20777(9223372036854775806) as '2**63-2',
6962
bug20777(9223372036854775807) as '2**63-1',
6963
bug20777(9223372036854775808) as '2**63',
6964
bug20777(9223372036854775809) as '2**63+1',
6965
bug20777(18446744073709551614) as '2**64-2',
6966
bug20777(18446744073709551615) as '2**64-1',
6967
bug20777(18446744073709551616) as '2**64',
6969
bug20777(-1) as '-1';
6970
insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616, 0, -1);
6971
show create table examplebug20777;
6972
select * from examplebug20777 order by i;
6974
drop table examplebug20777;
6975
select bug20777(18446744073709551613)+1;
6976
drop function bug20777;
6980
--echo End of 5.0 tests.
6762
6983
# BUG#NNNN: New bug synopsis
6765
6986
#drop procedure if exists bugNNNN|
6766
6987
#--enable_warnings
6767
6988
#create procedure bugNNNN...
6769
6990
# Add bugs above this line. Use existing tables t1 and t2 when
6770
# practical, or create table t3, t4 etc temporarily (and drop them).
6991
# practical, or create table t3,t4 etc temporarily (and drop them).
6992
# NOTE: The delimiter is `|`, and not `;`. It is changed to `;`
6993
# at the end of the file!
6772
6997
drop table t1,t2;