limit DEFAULT_CTX_ID of tenant_500 from 4G to 2G

This commit is contained in:
tushicheng
2023-09-28 02:09:45 +00:00
committed by ob-robot
parent 58a8ac5edc
commit 42f577e33d
96 changed files with 9489 additions and 9477 deletions

View File

@ -1892,7 +1892,7 @@ create function f(x int) returns int
begin
if x>1 then
return x;
else
else
signal SQLSTATE '01000';
end if;
end//
@ -1943,7 +1943,7 @@ ERROR 02000: Unhandled user-defined not found condition
drop function f;
### need has return in mysql function
###
###
DROP FUNCTION IF EXISTS `fun6`//
CREATE FUNCTION fun6 ( p1 INT) RETURNS VARCHAR(20)
@ -1980,8 +1980,8 @@ SELECT @num//
DROP FUNCTION IF EXISTS `fun6`//
### label dup
###
### label dup
###
DROP TABLE IF EXISTS result1//
CREATE TABLE result1(
id INT,
@ -2042,34 +2042,34 @@ DROP PROCEDURE IF EXISTS `pro_1`//
DROP PROCEDURE IF EXISTS `pro_2`//
DROP PROCEDURE IF EXISTS `pro_3`//
### ### varchar
### ###
### ### varchar
### ###
### DROP TABLE IF EXISTS t2//
### --error 1074
### CREATE TABLE t2 (
### id INT,
### res1 VARCHAR(128),
### d1 VARCHAR(16384)
### )//
### DROP TABLE IF EXISTS t3//
### CREATE TABLE t2 (
### id INT,
### res1 VARCHAR(128),
### d1 VARCHAR(16384)
### )//
### DROP TABLE IF EXISTS t3//
### --error 1074
### CREATE TABLE t3 (
### id INT,
### res1 VARCHAR(128),
### d1 VARCHAR(262145)
### CREATE TABLE t3 (
### id INT,
### res1 VARCHAR(128),
### d1 VARCHAR(262145)
### )//
### DROP FUNCTION IF EXISTS fun_l//
### --error 1074
### CREATE FUNCTION fun_l() RETURNS VARCHAR(262144)
### BEGIN
### DECLARE d1 VARCHAR(262144123456);
### DECLARE d1 VARCHAR(262144123456);
### SET d1='123456789012345678901234567890';
### RETURN '定义长度262144123456的VARCHAR(262144123456)类型的变量';
### END//
### --error 1305
### SELECT fun_l()//
### char
###
### END//
### --error 1305
### SELECT fun_l()//
### char
###
DROP TABLE IF EXISTS t1//
DROP TABLE IF EXISTS t2//
CREATE TABLE t1 (
@ -2078,7 +2078,7 @@ CREATE TABLE t1 (
d1 CHAR(255)
)//
### --error 1074
### TODO:
### TODO:
### CREATE TABLE t2 (
### id INT,
### res1 VARCHAR(128),
@ -2108,7 +2108,7 @@ SELECT * FROM t1//
+------+------+------+
### varbinary
###
###
DROP TABLE IF EXISTS t1//
CREATE TABLE t1 (
d1 VARBINARY(65536)
@ -2121,10 +2121,10 @@ ERROR 42000: Column length too big for column 'd1' (max = 1048576)
DROP FUNCTION IF EXISTS `fun_l`//
CREATE FUNCTION fun_l() RETURNS VARBINARY(65535)
BEGIN
BEGIN
DECLARE d1 VARBINARY(65536);
SET d1='123456789012345678901234567890';
RETURN '定义长度65536的VARCHAR类型的变量';
RETURN '定义长度65536的VARCHAR类型的变量';
END//
ERROR 42000: Column length too big for column '(null)' (max = 65535)
@ -2132,30 +2132,30 @@ SELECT fun_l()//
ERROR 42000: FUNCTION fun_l does not exist
### number
###
###
DROP FUNCTION IF EXISTS `fun_l`//
CREATE FUNCTION fun_l() RETURNS DEC(65,30)
BEGIN
DECLARE a DEC(66,30);
BEGIN
DECLARE a DEC(66,30);
SET a=123450.1415;
RETURN a;
RETURN a;
END//
ERROR 42000: Too big precision 66 specified for column '(null)'. Maximum is 65.
SELECT fun_l()//
ERROR 42000: FUNCTION fun_l does not exist
DROP FUNCTION IF EXISTS `fun_2`//
CREATE FUNCTION fun_2() RETURNS DEC(65,30)
BEGIN
DECLARE a DEC(65,31);
BEGIN
DECLARE a DEC(65,31);
SET a=50.1;
RETURN a;
RETURN a;
END//
ERROR 42000: Too big scale 31 specified for column '(null)'. Maximum is 30.
SELECT fun_2()//
ERROR 42000: FUNCTION fun_2 does not exist
### datetime
###
###
DROP TABLE IF EXISTS t2//
CREATE TABLE t2 (
id INT,
@ -2174,7 +2174,7 @@ SELECT fun_l()//
ERROR 42000: FUNCTION fun_l does not exist
### datetime max value insert fail
###
###
DROP TABLE IF EXISTS t2//
CREATE TABLE t2 (
id INT,
@ -2186,7 +2186,7 @@ CREATE TABLE t2 (
INSERT INTO t2 VALUES(1,'插入DATETIME类型数据','1000-01-01 00:00:00.123','2000-01-01 00:00:00.123','9999-12-31 23:59:59.999999')//
DROP PROCEDURE IF EXISTS `pro_1`//
CREATE PROCEDURE pro_1()
BEGIN
BEGIN
DECLARE d1 DATETIME DEFAULT '1000-01-01 00:00:00.000000';
DECLARE d2 DATETIME(0) DEFAULT '2021-07-02 23:59:59.999999';
DECLARE d3 DATETIME(6) DEFAULT '9999-12-31 23:59:59.999999';
@ -2204,7 +2204,7 @@ SELECT * FROM t2//
+------+----------------------------------------+---------------------+---------------------+----------------------------+
### int
###
###
DROP TABLE IF EXISTS t1//
CREATE TABLE t1 (
id INT,
@ -2229,7 +2229,7 @@ SELECT * FROM t1//
### commit
### rollback
###
###
DROP TABLE IF EXISTS t1//
CREATE TABLE t1
( a INT
@ -2326,19 +2326,19 @@ END//
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
### BIT
###
###
DROP TABLE IF EXISTS t1;//
DROP PROCEDURE IF EXISTS `pro_2`;//
CREATE PROCEDURE pro_2()
BEGIN
CREATE TABLE t1 (id INT,a BIT(65));
INSERT INTO t1 VALUES(1,b'0');
CREATE TABLE t1 (id INT,a BIT(65));
INSERT INTO t1 VALUES(1,b'0');
END;
//
ERROR 42000: Display width out of range for column 'CREATE TABLE t1 (id INT,a BIT(65))' (max = 64)
### load data
###
###
DROP TABLE IF EXISTS t1//
CREATE TABLE t1 (a INT)//
INSERT INTO t1 VALUES (1),(2),(3)//
@ -2351,7 +2351,7 @@ END//
ERROR HY000: 'LOAD DATA' is not allowed in stored procedure.
### lock
###
###
DROP TABLE IF EXISTS t1//
CREATE TABLE t1 (a INT)//
INSERT INTO t1 VALUES (1),(2),(3)//

View File

@ -539,7 +539,7 @@ BEGIN
IF tmp_i_price > 0 THEN
SET tmp_ol_amount = tmp_i_price * tmp_ol_quantity;
call new_order_2(tmp_w_id, tmp_d_id, tmp_i_id,
tmp_ol_quantity, tmp_i_price,
tmp_ol_quantity, tmp_i_price,
tmp_i_name, tmp_i_data,
out_d_next_o_id, tmp_ol_amount,
tmp_ol_supply_w_id, 4, tmp_s_quantity);
@ -584,7 +584,7 @@ BEGIN
THEN
SET tmp_ol_amount = tmp_i_price * tmp_ol_quantity;
call new_order_2(tmp_w_id, tmp_d_id, tmp_i_id,
tmp_ol_quantity, tmp_i_price,
tmp_ol_quantity, tmp_i_price,
tmp_i_name, tmp_i_data,
out_d_next_o_id, tmp_ol_amount,
tmp_ol_supply_w_id, 6, tmp_s_quantity);
@ -699,7 +699,7 @@ BEGIN
THEN
SET tmp_ol_amount = tmp_i_price * tmp_ol_quantity;
call new_order_2(tmp_w_id, tmp_d_id, tmp_i_id,
tmp_ol_quantity, tmp_i_price,
tmp_ol_quantity, tmp_i_price,
tmp_i_name, tmp_i_data,
out_d_next_o_id, tmp_ol_amount,
tmp_ol_supply_w_id, 11, tmp_s_quantity);
@ -722,7 +722,7 @@ BEGIN
THEN
SET tmp_ol_amount = tmp_i_price * tmp_ol_quantity;
call new_order_2(tmp_w_id, tmp_d_id, tmp_i_id,
tmp_ol_quantity, tmp_i_price,
tmp_ol_quantity, tmp_i_price,
tmp_i_name, tmp_i_data,
out_d_next_o_id, tmp_ol_amount,
tmp_ol_supply_w_id, 12, tmp_s_quantity);
@ -802,7 +802,7 @@ BEGIN
END//
CREATE PROCEDURE order_status (in_c_id INT,
in_c_w_id INT,
in_c_w_id INT,
in_c_d_id INT,
in_c_last VARCHAR(16))
BEGIN
@ -1019,7 +1019,7 @@ BEGIN
DECLARE out_w_state VARCHAR(2);
DECLARE out_w_zip VARCHAR(9);
DECLARE out_w_ytd INTEGER;
DECLARE out_d_name VARCHAR(10);
DECLARE out_d_street_1 VARCHAR(20);
DECLARE out_d_street_2 VARCHAR(20);
@ -1027,7 +1027,7 @@ BEGIN
DECLARE out_d_state VARCHAR(2);
DECLARE out_d_zip VARCHAR(9);
DECLARE out_d_ytd INTEGER;
DECLARE out_c_id INTEGER;
DECLARE out_c_first VARCHAR(16);
DECLARE out_c_middle VARCHAR(2);
@ -1412,3 +1412,5 @@ DROP PROCEDURE new_order;
DROP PROCEDURE order_status;
DROP PROCEDURE payment;
DROP PROCEDURE stock_level;

View File

@ -1557,3 +1557,4 @@ select * from b;
drop table a;
drop table b;
drop procedure p;

View File

@ -277,8 +277,8 @@ begin
DECLARE continue HANDLER FOR sqlexception insert into a values(-1);
begin
DECLARE aaa CONDITION FOR SQLSTATE '42S02';
DECLARE continue HANDLER FOR sqlexception
begin
DECLARE continue HANDLER FOR sqlexception
begin
insert into a values(0);
insert into t values(1);
insert into a values(6);

View File

@ -17,7 +17,7 @@ BEGIN
CALL p_not_exists();
END|
# should not return valgrind warnings
### TODO : --error 1305
### TODO : --error 1305
CALL p3(f2());
ERROR 2F005: FUNCTION ended without RETURN
@ -36,7 +36,7 @@ BEGIN
CALL p_not_exists();
END|
# should not return valgrind warnings
### TODO : --error 1305
### TODO : --error 1305
CALL p3(f2());
ERROR 2F005: FUNCTION ended without RETURN
@ -51,7 +51,7 @@ BEGIN
RETURN f_not_exists () ;
END|
# should not return valgrind warnings
### TODO : --error 1305
### TODO : --error 1305
SELECT f2();
ERROR 2F005: FUNCTION ended without RETURN
@ -68,36 +68,36 @@ USE test;
## DROP TRIGGER IF EXISTS tr1;
## DROP PROCEDURE IF EXISTS p1;
## --enable_warnings
##
##
## CREATE TABLE t1 (f1 INTEGER);
## CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
## CREATE PROCEDURE p1 () DROP TRIGGER tr1;
##
##
## CALL p1 ();
## --error ER_TRG_DOES_NOT_EXIST
## CALL p1 ();
##
##
## DROP TABLE t1;
## DROP PROCEDURE p1;
##
##
## --echo #
## --echo # Bug#50423: Crash on second call of a procedure dropping a trigger
## --echo #
##
##
## --disable_warnings
## DROP TABLE IF EXISTS t1;
## DROP TRIGGER IF EXISTS tr1;
## DROP PROCEDURE IF EXISTS p1;
## --enable_warnings
##
##
## CREATE TABLE t1 (f1 INTEGER);
## CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
## CREATE PROCEDURE p1 () DROP TRIGGER tr1;
##
##
## CALL p1 ();
## --error ER_TRG_DOES_NOT_EXIST
## CALL p1 ();
##
##
## DROP TABLE t1;
## DROP PROCEDURE p1;
#
@ -145,8 +145,8 @@ DROP DATABASE db1;
DROP DATABASE db2;
#
# Bug#13105873:valgrind warning:possible crash in foreign
# key handling on subsequent create table if not exists
# Bug#13105873:valgrind warning:possible crash in foreign
# key handling on subsequent create table if not exists
#
## oceanbase not support foreign key yet!
## --disable_warnings
@ -164,7 +164,7 @@ DROP DATABASE db2;
## DELIMITER ;$
## CALL p1();
## --echo # below stmt should not return valgrind warnings
## CALL p1();
## CALL p1();
## DROP DATABASE testdb;
## USE test;
End of 5.1 tests

View File

@ -42,3 +42,4 @@ select * from t3 order by f asc|
drop table t3|
drop procedure fib|
set @@max_sp_recursion_depth= 0|

View File

@ -62,33 +62,33 @@ BEGIN
DECLARE i1, i2, i3, i4 TINYINT;
DECLARE u1, u2, u3, u4 TINYINT UNSIGNED;
DECLARE d1, d2, d3 DECIMAL(64, 2);
SET i1 = 1e200;
SET i2 = -1e200;
SET i3 = 300;
SET i4 = -300;
SELECT i1, i2, i3, i4;
SET i1 = 10 * 10 * 10;
SET i2 = -10 * 10 * 10;
SET i3 = sign(10 * 10) * 10 * 20;
SET i4 = sign(-10 * 10) * -10 * 20;
SELECT i1, i2, i3, i4;
SET u1 = 1e200;
SET u2 = -1e200;
SET u3 = 300;
SET u4 = -300;
SELECT u1, u2, u3, u4;
SET u1 = 10 * 10 * 10;
SET u2 = -10 * 10 * 10;
SET u3 = sign(10 * 10) * 10 * 20;
SET u4 = sign(-10 * 10) * -10 * 20;
SELECT u1, u2, u3, u4;
SET d1 = 1234;
@ -376,33 +376,33 @@ BEGIN
DECLARE i1, i2, i3, i4 TINYINT;
DECLARE u1, u2, u3, u4 TINYINT UNSIGNED;
DECLARE d1, d2, d3 DECIMAL(64, 2);
SET i1 = 1e200;
SET i2 = -1e200;
SET i3 = 300;
SET i4 = -300;
SELECT i1, i2, i3, i4;
SET i1 = 10 * 10 * 10;
SET i2 = -10 * 10 * 10;
SET i3 = sign(10 * 10) * 10 * 20;
SET i4 = sign(-10 * 10) * -10 * 20;
SELECT i1, i2, i3, i4;
SET u1 = 1e200;
SET u2 = -1e200;
SET u3 = 300;
SET u4 = -300;
SELECT u1, u2, u3, u4;
SET u1 = 10 * 10 * 10;
SET u2 = -10 * 10 * 10;
SET u3 = sign(10 * 10) * 10 * 20;
SET u4 = sign(-10 * 10) * -10 * 20;
SELECT u1, u2, u3, u4;
SET d1 = 1234;
@ -615,7 +615,7 @@ BEGIN
WHILE i > 0 DO
INSERT INTO t1(log_msg) VALUES(CONCAT('p1: case1: case2: loop: i: ', i));
CASE MOD(i, 2)
WHEN 0 THEN
INSERT INTO t1(log_msg) VALUES('p1: case1: case2: loop: i is even');
@ -624,7 +624,7 @@ BEGIN
ELSE
INSERT INTO t1(log_msg) VALUES('p1: case1: case2: loop: ERROR');
END CASE;
SET i = i - 1;
END WHILE;
END;
@ -659,7 +659,7 @@ BEGIN
WHILE i > 0 DO
INSERT INTO t1(log_msg) VALUES(CONCAT('p1: case4: case5: loop: i: ', i));
CASE MOD(i, 2)
WHEN 0 THEN
INSERT INTO t1(log_msg) VALUES('p1: case4: case5: loop: i is even');
@ -668,7 +668,7 @@ BEGIN
ELSE
INSERT INTO t1(log_msg) VALUES('p1: case4: case5: loop: ERROR');
END CASE;
SET i = i - 1;
END WHILE;
END;
@ -867,7 +867,7 @@ BUG#13675
## DROP TABLE t1;
## END|
## delimiter ;|
##
##
## CALL p1(NOW());
## CALL p1('test');
## DROP PROCEDURE p1;
@ -1304,30 +1304,30 @@ DROP TABLE t1;
## DROP FUNCTION IF EXISTS f1;
## --enable_warnings
## delimiter |;
##
##
## CREATE PROCEDURE p1(arg ENUM('a', 'b'))
## BEGIN
## SELECT arg;
## END|
##
##
## CREATE PROCEDURE p2(arg ENUM('a', 'b'))
## BEGIN
## DECLARE var ENUM('c', 'd') DEFAULT arg;
##
##
## SELECT arg, var;
## END|
##
##
## CREATE FUNCTION f1(arg ENUM('a', 'b')) RETURNS ENUM('c', 'd')
## BEGIN
## RETURN arg;
## END|
##
##
## delimiter ;|
##
##
## CALL p1('c');
##
##
## CALL p2('a');
##
##
## SELECT f1('a');
## DROP PROCEDURE p1;
## DROP PROCEDURE p2;
@ -1548,7 +1548,7 @@ CREATE PROCEDURE bug27415_text_test2(entity_id_str_in VARCHAR(255))
BEGIN
DECLARE str_remainder VARCHAR(255);
DECLARE str_remainder2 VARCHAR(255);
SET str_remainder2 = entity_id_str_in;
select 'before substr', str_remainder2;
SET str_remainder = SUBSTRING(str_remainder2, 3);
@ -1606,7 +1606,7 @@ DROP PROCEDURE bug27415_text_test2|
drop function if exists f1;
drop table if exists t1;
create function f1() returns int
create function f1() returns int
begin
if @a=1 then set @b='abc';
else set @b=1;

View File

@ -962,7 +962,7 @@ select id, f1(), f3() from t1 order by id|
id f1() f3()
a 3 1
b 3 1
create function f4() returns double
create function f4() returns double
return (select d from t1, t2 where t1.data = t2.i and t1.id= "b")|
select f4()|
f4()
@ -1450,7 +1450,7 @@ create procedure h_se()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_se';
begin
declare continue handler for 1062 -- ER_DUP_ENTRY
@ -1462,11 +1462,11 @@ create procedure h_ss()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_ss';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
declare continue handler for sqlstate '23000'
select 'Inner (good)' as 'h_ss';
insert into t3 values (1);
end;
@ -1475,7 +1475,7 @@ create procedure h_sn()
deterministic
begin
-- Note: '02000' is more specific than NOT FOUND ;
-- there might be other not found states
-- there might be other not found states
declare continue handler for sqlstate '02000' -- no data
select 'Outer (bad)' as 'h_sn';
begin
@ -1503,7 +1503,7 @@ create procedure h_sx()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_sx';
begin
declare continue handler for sqlexception
@ -1768,7 +1768,7 @@ create table t3(a int)|
drop procedure if exists bug1862|
create procedure bug1862()
begin
insert into t3 values(2);
insert into t3 values(2);
flush tables;
end|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near 'flush tables' at line 4
@ -1929,7 +1929,7 @@ insert into t3 values (123456789012)|
drop procedure if exists bug2780|
create procedure bug2780()
begin
declare exit handler for sqlwarning set @x = 1;
declare exit handler for sqlwarning set @x = 1;
set @x = 0;
insert into t3 values (123456789012);
insert into t3 values (0);
@ -1945,12 +1945,12 @@ s1
0
drop procedure bug2780|
drop table t3|
create table t3 (
create table t3 (
OrderID int not null,
MarketID int,
primary key (OrderID)
)|
create table t4 (
create table t4 (
MarketID int not null,
Market varchar(60),
Status char(1),
@ -1962,20 +1962,20 @@ insert t4 (MarketID,Market,Status) values (1,"MarketID One","A")|
insert t4 (MarketID,Market,Status) values (2,"MarketID Two","A")|
drop procedure if exists bug2656_1|
create procedure bug2656_1()
begin
begin
select
m.Market
from t4 m JOIN t3 o
from t4 m JOIN t3 o
ON o.MarketID != 1 and o.MarketID = m.MarketID;
end |
drop procedure if exists bug2656_2|
create procedure bug2656_2()
begin
begin
select
m.Market
from
from
t4 m, t3 o
where
where
m.MarketID != 1 and m.MarketID = o.MarketID;
end |
call bug2656_1()|
@ -2213,7 +2213,7 @@ drop procedure if exists bug4904|
create procedure bug4904 ()
begin
declare continue handler for sqlstate 'HY000' begin end;
select s1 from t3 union select s2 from t3;
select s1 from t3 union select s2 from t3;
end|
call bug4904()|
s1
@ -2645,20 +2645,20 @@ end|
create procedure bug9074()
begin
declare x1, x2, x3, x4, x5, x6 int default 0;
begin
declare continue handler for sqlstate '23000' set x5 = 1;
insert into t3 values ('a', 'b');
set x6 = 1;
begin
declare continue handler for sqlstate '23000' set x5 = 1;
insert into t3 values ('a', 'b');
set x6 = 1;
end;
begin1_label:
begin
declare continue handler for sqlstate '23000' set x1 = 1;
insert into t3 values ('a', 'b');
set x2 = 1;
declare continue handler for sqlstate '23000' set x1 = 1;
insert into t3 values ('a', 'b');
set x2 = 1;
begin2_label:
begin
declare exit handler for sqlstate '23000' set x3 = 1;
set x4= 1;
begin
declare exit handler for sqlstate '23000' set x3 = 1;
set x4= 1;
insert into t3 values ('a','b');
set x4= 0;
end begin2_label;
@ -2822,22 +2822,22 @@ drop function if exists bug9775|
create function bug9775(v1 char(1)) returns enum('a','b') return v1|
select bug9775('a'),bug9775('b'),bug9775('c')|
bug9775('a') bug9775('b') bug9775('c')
a b
a b
drop function bug9775|
create function bug9775(v1 int) returns enum('a','b') return v1|
select bug9775(1),bug9775(2),bug9775(3)|
bug9775(1) bug9775(2) bug9775(3)
a b
a b
drop function bug9775|
create function bug9775(v1 char(1)) returns set('a','b') return v1|
select bug9775('a'),bug9775('b'),bug9775('a,b'),bug9775('c')|
bug9775('a') bug9775('b') bug9775('a,b') bug9775('c')
a b a
a b a
drop function bug9775|
create function bug9775(v1 int) returns set('a','b') return v1|
select bug9775(1),bug9775(2),bug9775(3),bug9775(4)|
bug9775(1) bug9775(2) bug9775(3) bug9775(4)
a b a,b
a b a,b
drop function bug9775|
drop function if exists bug8861|
create function bug8861(v1 int) returns year return v1|
@ -2900,12 +2900,12 @@ v
5
drop procedure bug5963_1|
drop table t3|
create procedure bug5963_2 (cfk_value int)
begin
if cfk_value in (select cpk from t3) then
set @x = 5;
end if;
end;
create procedure bug5963_2 (cfk_value int)
begin
if cfk_value in (select cpk from t3) then
set @x = 5;
end if;
end;
|
create table t3 (cpk int)|
insert into t3 values (1)|
@ -3140,16 +3140,16 @@ drop procedure if exists bug8692|
create table t3 (c1 varchar(5), c2 char(5), c3 enum('one','two'), c4 text, c5 blob, c6 char(5), c7 varchar(5))|
insert into t3 values ('', '', '', '', '', '', NULL)|
create procedure bug8692()
begin
declare v1 VARCHAR(10);
declare v2 VARCHAR(10);
declare v3 VARCHAR(10);
declare v4 VARCHAR(10);
declare v5 VARCHAR(10);
declare v6 VARCHAR(10);
declare v7 VARCHAR(10);
declare c8692 cursor for select c1,c2,c3,c4,c5,c6,c7 from t3;
open c8692;
begin
declare v1 VARCHAR(10);
declare v2 VARCHAR(10);
declare v3 VARCHAR(10);
declare v4 VARCHAR(10);
declare v5 VARCHAR(10);
declare v6 VARCHAR(10);
declare v7 VARCHAR(10);
declare c8692 cursor for select c1,c2,c3,c4,c5,c6,c7 from t3;
open c8692;
fetch c8692 into v1,v2,v3,v4,v5,v6,v7;
select v1, v2, v3, v4, v5, v6, v7;
end|
@ -3265,7 +3265,7 @@ drop procedure if exists bug12168|
drop table if exists t3|
drop procedure if exists bug11333|
create table t3 (c1 char(128))|
insert into t3 values
insert into t3 values
('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')|
create procedure bug11333(i int)
begin
@ -3651,7 +3651,7 @@ create procedure bug10100p(prm int, inout res int)
begin
set res = res * prm;
if prm > 1 then
call bug10100p(prm - 1, res);
call bug10100p(prm - 1, res);
end if;
end|
create procedure bug10100t(prm int)
@ -4192,7 +4192,7 @@ insert into t3 values
( '2005-01-04' ), ( '2005-02-01' ), ( '2005-02-02' )|
create procedure bug17476(pDateFormat varchar(10))
select date_format(t3.d, pDateFormat), count(*)
from t3
from t3
group by date_format(t3.d, pDateFormat)|
call bug17476('%Y-%m')|
date_format(t3.d, pDateFormat) count(*)
@ -4340,7 +4340,7 @@ use bug18344_0123456789012|
create procedure bug18344() begin end|
create procedure bug18344_2() begin end|
use test|
select schema_name from information_schema.schemata where
select schema_name from information_schema.schemata where
schema_name like 'bug18344%'|
schema_name
bug18344_012345678901
@ -4354,7 +4354,7 @@ bug18344 bug18344_0123456789012
bug18344_2 bug18344_0123456789012
drop database bug18344_012345678901|
drop database bug18344_0123456789012|
select schema_name from information_schema.schemata where
select schema_name from information_schema.schemata where
schema_name like 'bug18344%'|
schema_name
select routine_name,routine_schema from information_schema.routines where
@ -4465,7 +4465,7 @@ create database mysqltest1 charset=utf8|
create database mysqltest2 charset=utf8|
create procedure mysqltest1.p1()
begin
-- alters the default collation of database test
-- alters the default collation of database test
alter database character set koi8r;
end|
use mysqltest1|
@ -4941,7 +4941,7 @@ CREATE FUNCTION bug21493(paramMember VARCHAR(15)) RETURNS varchar(45)
BEGIN
DECLARE tracks VARCHAR(45);
SELECT GROUP_CONCAT(Track SEPARATOR ', ') FROM t4
WHERE Member_ID=paramMember AND Action='Enrolled' AND
WHERE Member_ID=paramMember AND Action='Enrolled' AND
(Track,Action_Date) IN (SELECT Track, MAX(Action_Date) FROM t4
WHERE Member_ID=paramMember GROUP BY Track) INTO tracks;
RETURN tracks;
@ -5264,13 +5264,13 @@ DROP FUNCTION IF EXISTS bug23760_rc_test|
CREATE TABLE bug23760 (
id INT NOT NULL AUTO_INCREMENT ,
num INT NOT NULL ,
PRIMARY KEY ( id )
PRIMARY KEY ( id )
)|
CREATE TABLE bug23760_log (
id INT NOT NULL AUTO_INCREMENT ,
reason VARCHAR(50)NULL ,
ammount INT NOT NULL ,
PRIMARY KEY ( id )
PRIMARY KEY ( id )
)|
CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT)
BEGIN
@ -5634,14 +5634,14 @@ select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
ERROR 22003: Out of range value for column
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
ERROR 22003: Out of range value for column
create table examplebug20777 as select
create table examplebug20777 as select
0 as 'i',
bug20777(9223372036854775806) as '2**63-2',
bug20777(9223372036854775807) as '2**63-1',
bug20777(9223372036854775808) as '2**63',
bug20777(9223372036854775809) as '2**63+1',
bug20777(18446744073709551614) as '2**64-2',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551616) as '2**64';
ERROR 22003: Out of range value for column
select bug20777(18446744073709551613)+1;
@ -5873,7 +5873,7 @@ select 3;
/*!00000 select 4; */
/*!99999 select 5; */
end
proc_25411_b
proc_25411_b
/* real comment */
/*! p1 int, */
/*!00000 p2 int */
@ -6606,7 +6606,7 @@ DROP FUNCTION f3;
DROP FUNCTION f4;
DROP TABLE t1;
#
# Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non
# Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non
# strict SQL mode
#
DROP PROCEDURE IF EXISTS p1;
@ -6657,7 +6657,7 @@ select * from t1 limit a, b;
Warnings:
Warning 5002 Resolve error
#
# Try to use data types not allowed in LIMIT
# Try to use data types not allowed in LIMIT
#
drop procedure p1;
create procedure p1(p1 date, p2 date) select * from t1 limit p1, p2;
@ -6727,7 +6727,7 @@ f1()
NULL
drop function f1;
#
# Try to use data types not allowed in LIMIT
# Try to use data types not allowed in LIMIT
#
create function f1(p1 date, p2 date)
returns int
@ -6815,10 +6815,10 @@ f1(3, 2)
drop table t1;
drop procedure p1;
drop function f1;
#
# BUG#11766234: 59299: ASSERT (TABLE_REF->TABLE || TABLE_REF->VIEW)
#
# BUG#11766234: 59299: ASSERT (TABLE_REF->TABLE || TABLE_REF->VIEW)
# FAILS IN SET_FIELD_ITERATOR
#
#
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
CREATE VIEW v1 AS SELECT a FROM t2;
@ -6838,7 +6838,7 @@ DROP PROCEDURE proc;
# --
# -- Bug 11765684 - 58674: SP-cache does not detect changes in
# -- pre-locking list caused by triggers
# ---
# ---
DROP TABLE IF EXISTS t1;
DROP TABLE IF EXISTS t2;
DROP TABLE IF EXISTS t3;
@ -6868,7 +6868,7 @@ DROP PROCEDURE p1;
# --
# -- Bug#12652769 - 61470: case operator in stored routine retains old
# -- value of input parameter
# ---
# ---
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf8);
@ -6945,10 +6945,10 @@ DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 VALUES (1);
CREATE PROCEDURE p1()
BEGIN
DECLARE foo, cnt INT UNSIGNED DEFAULT 1;
SET foo = (SELECT MIN(c1) FROM t1 LIMIT cnt);
CREATE PROCEDURE p1()
BEGIN
DECLARE foo, cnt INT UNSIGNED DEFAULT 1;
SET foo = (SELECT MIN(c1) FROM t1 LIMIT cnt);
END|
CREATE PROCEDURE p2()
BEGIN

View File

@ -617,7 +617,7 @@ drop table a;
drop procedure p;
drop procedure pp;
#case 36
#case 36
create table a(a1 varchar(100));
insert into a values('a');
create table b(b1 varchar(100));
@ -1633,7 +1633,7 @@ create procedure p()
return 42;//
delimiter ;//
#case 89
#case 89
set @a=0;
select @a;
delimiter //;
@ -1679,7 +1679,7 @@ create function f(x int) returns int
begin
if x>1 then
return x;
else
else
signal SQLSTATE '01000';
end if;
end//
@ -1722,7 +1722,7 @@ select f(1);
drop function f;
### need has return in mysql function
###
###
delimiter //;
DROP FUNCTION IF EXISTS `fun6`//
@ -1752,8 +1752,8 @@ SELECT @num//
DROP FUNCTION IF EXISTS `fun6`//
delimiter ;//
### label dup
###
### label dup
###
delimiter //;
--disable_warnings ONCE
DROP TABLE IF EXISTS result1//
@ -1812,35 +1812,35 @@ DROP PROCEDURE IF EXISTS `pro_3`//
delimiter ;//
delimiter //;
### ### varchar
### ###
### ### varchar
### ###
### DROP TABLE IF EXISTS t2//
### --error 1074
### CREATE TABLE t2 (
### id INT,
### res1 VARCHAR(128),
### d1 VARCHAR(16384)
### )//
### DROP TABLE IF EXISTS t3//
### CREATE TABLE t2 (
### id INT,
### res1 VARCHAR(128),
### d1 VARCHAR(16384)
### )//
### DROP TABLE IF EXISTS t3//
### --error 1074
### CREATE TABLE t3 (
### id INT,
### res1 VARCHAR(128),
### d1 VARCHAR(262145)
### CREATE TABLE t3 (
### id INT,
### res1 VARCHAR(128),
### d1 VARCHAR(262145)
### )//
### DROP FUNCTION IF EXISTS fun_l//
### --error 1074
### CREATE FUNCTION fun_l() RETURNS VARCHAR(262144)
### BEGIN
### DECLARE d1 VARCHAR(262144123456);
### DECLARE d1 VARCHAR(262144123456);
### SET d1='123456789012345678901234567890';
### RETURN '定义长度262144123456的VARCHAR(262144123456)类型的变量';
### END//
### --error 1305
### SELECT fun_l()//
### END//
### --error 1305
### SELECT fun_l()//
### char
###
### char
###
--disable_warnings
DROP TABLE IF EXISTS t1//
DROP TABLE IF EXISTS t2//
@ -1851,7 +1851,7 @@ delimiter //;
d1 CHAR(255)
)//
### --error 1074
### TODO:
### TODO:
### CREATE TABLE t2 (
### id INT,
### res1 VARCHAR(128),
@ -1879,7 +1879,7 @@ delimiter //;
### varbinary
###
###
--disable_warnings ONCE
DROP TABLE IF EXISTS t1//
CREATE TABLE t1 (
@ -1895,41 +1895,41 @@ CREATE TABLE t2 (
DROP FUNCTION IF EXISTS `fun_l`//
--error 1074
CREATE FUNCTION fun_l() RETURNS VARBINARY(65535)
BEGIN
BEGIN
DECLARE d1 VARBINARY(65536);
SET d1='123456789012345678901234567890';
RETURN '定义长度65536的VARCHAR类型的变量';
END//
RETURN '定义长度65536的VARCHAR类型的变量';
END//
--error 1305
SELECT fun_l()//
### number
###
###
DROP FUNCTION IF EXISTS `fun_l`//
--error 1426
CREATE FUNCTION fun_l() RETURNS DEC(65,30)
BEGIN
DECLARE a DEC(66,30);
BEGIN
DECLARE a DEC(66,30);
SET a=123450.1415;
RETURN a;
RETURN a;
END//
--error 1305
--error 1305
SELECT fun_l()//
DROP FUNCTION IF EXISTS `fun_2`//
--error 1425
CREATE FUNCTION fun_2() RETURNS DEC(65,30)
BEGIN
DECLARE a DEC(65,31);
BEGIN
DECLARE a DEC(65,31);
SET a=50.1;
RETURN a;
RETURN a;
END//
--error 1305
--error 1305
SELECT fun_2()//
### datetime
###
###
--disable_warnings ONCE
DROP TABLE IF EXISTS t2//
--error 1426
@ -1949,7 +1949,7 @@ END//
SELECT fun_l()//
### datetime max value insert fail
###
###
--disable_warnings ONCE
DROP TABLE IF EXISTS t2//
CREATE TABLE t2 (
@ -1962,7 +1962,7 @@ CREATE TABLE t2 (
INSERT INTO t2 VALUES(1,'插入DATETIME类型数据','1000-01-01 00:00:00.123','2000-01-01 00:00:00.123','9999-12-31 23:59:59.999999')//
DROP PROCEDURE IF EXISTS `pro_1`//
CREATE PROCEDURE pro_1()
BEGIN
BEGIN
DECLARE d1 DATETIME DEFAULT '1000-01-01 00:00:00.000000';
DECLARE d2 DATETIME(0) DEFAULT '2021-07-02 23:59:59.999999';
DECLARE d3 DATETIME(6) DEFAULT '9999-12-31 23:59:59.999999';
@ -1973,7 +1973,7 @@ CALL pro_1()//
SELECT * FROM t2//
### int
###
###
--disable_warnings ONCE
DROP TABLE IF EXISTS t1//
CREATE TABLE t1 (
@ -1995,7 +1995,7 @@ SELECT * FROM t1//
### commit
### rollback
###
###
--disable_warnings ONCE
DROP TABLE IF EXISTS t1//
CREATE TABLE t1
@ -2062,20 +2062,20 @@ BEGIN
END//
### BIT
###
###
--disable_warnings ONCE
DROP TABLE IF EXISTS t1;//
DROP PROCEDURE IF EXISTS `pro_2`;//
--error 1439
CREATE PROCEDURE pro_2()
BEGIN
CREATE TABLE t1 (id INT,a BIT(65));
INSERT INTO t1 VALUES(1,b'0');
CREATE TABLE t1 (id INT,a BIT(65));
INSERT INTO t1 VALUES(1,b'0');
END;
//
### load data
###
###
--disable_warnings ONCE
DROP TABLE IF EXISTS t1//
CREATE TABLE t1 (a INT)//
@ -2089,7 +2089,7 @@ BEGIN
END//
### lock
###
###
--disable_warnings ONCE
DROP TABLE IF EXISTS t1//
CREATE TABLE t1 (a INT)//

View File

@ -558,7 +558,7 @@ BEGIN
IF tmp_i_price > 0 THEN
SET tmp_ol_amount = tmp_i_price * tmp_ol_quantity;
call new_order_2(tmp_w_id, tmp_d_id, tmp_i_id,
tmp_ol_quantity, tmp_i_price,
tmp_ol_quantity, tmp_i_price,
tmp_i_name, tmp_i_data,
out_d_next_o_id, tmp_ol_amount,
tmp_ol_supply_w_id, 4, tmp_s_quantity);
@ -603,7 +603,7 @@ BEGIN
THEN
SET tmp_ol_amount = tmp_i_price * tmp_ol_quantity;
call new_order_2(tmp_w_id, tmp_d_id, tmp_i_id,
tmp_ol_quantity, tmp_i_price,
tmp_ol_quantity, tmp_i_price,
tmp_i_name, tmp_i_data,
out_d_next_o_id, tmp_ol_amount,
tmp_ol_supply_w_id, 6, tmp_s_quantity);
@ -718,7 +718,7 @@ BEGIN
THEN
SET tmp_ol_amount = tmp_i_price * tmp_ol_quantity;
call new_order_2(tmp_w_id, tmp_d_id, tmp_i_id,
tmp_ol_quantity, tmp_i_price,
tmp_ol_quantity, tmp_i_price,
tmp_i_name, tmp_i_data,
out_d_next_o_id, tmp_ol_amount,
tmp_ol_supply_w_id, 11, tmp_s_quantity);
@ -741,7 +741,7 @@ BEGIN
THEN
SET tmp_ol_amount = tmp_i_price * tmp_ol_quantity;
call new_order_2(tmp_w_id, tmp_d_id, tmp_i_id,
tmp_ol_quantity, tmp_i_price,
tmp_ol_quantity, tmp_i_price,
tmp_i_name, tmp_i_data,
out_d_next_o_id, tmp_ol_amount,
tmp_ol_supply_w_id, 12, tmp_s_quantity);
@ -821,7 +821,7 @@ BEGIN
END//
CREATE PROCEDURE order_status (in_c_id INT,
in_c_w_id INT,
in_c_w_id INT,
in_c_d_id INT,
in_c_last VARCHAR(16))
BEGIN
@ -1039,7 +1039,7 @@ BEGIN
DECLARE out_w_state VARCHAR(2);
DECLARE out_w_zip VARCHAR(9);
DECLARE out_w_ytd INTEGER;
DECLARE out_d_name VARCHAR(10);
DECLARE out_d_street_1 VARCHAR(20);
DECLARE out_d_street_2 VARCHAR(20);
@ -1047,7 +1047,7 @@ BEGIN
DECLARE out_d_state VARCHAR(2);
DECLARE out_d_zip VARCHAR(9);
DECLARE out_d_ytd INTEGER;
DECLARE out_c_id INTEGER;
DECLARE out_c_first VARCHAR(16);
DECLARE out_c_middle VARCHAR(2);
@ -1435,3 +1435,6 @@ DROP PROCEDURE new_order;
DROP PROCEDURE order_status;
DROP PROCEDURE payment;
DROP PROCEDURE stock_level;

View File

@ -45,7 +45,7 @@ select * from a;
drop table a;
drop procedure p;
#case 2
#case 2
create table a(a1 int);
delimiter //;
create procedure p()
@ -1489,3 +1489,4 @@ select * from b;
drop table a;
drop table b;
drop procedure p;

View File

@ -297,8 +297,8 @@ begin
DECLARE continue HANDLER FOR sqlexception insert into a values(-1);
begin
DECLARE aaa CONDITION FOR SQLSTATE '42S02';
DECLARE continue HANDLER FOR sqlexception
begin
DECLARE continue HANDLER FOR sqlexception
begin
insert into a values(0);
insert into t values(1);
insert into a values(6);

View File

@ -34,7 +34,7 @@ BEGIN
END|
DELIMITER ;|
--echo # should not return valgrind warnings
### TODO : --error 1305
### TODO : --error 1305
--error 1321
CALL p3(f2());
@ -55,8 +55,8 @@ BEGIN
END|
DELIMITER ;|
--echo # should not return valgrind warnings
### TODO : --error 1305
--error 1321
### TODO : --error 1305
--error 1321
CALL p3(f2());
DROP SCHEMA testdb;
@ -72,7 +72,7 @@ BEGIN
END|
DELIMITER ;|
--echo # should not return valgrind warnings
### TODO : --error 1305
### TODO : --error 1305
--error 1321
SELECT f2();
@ -91,36 +91,36 @@ USE test;
## DROP TRIGGER IF EXISTS tr1;
## DROP PROCEDURE IF EXISTS p1;
## --enable_warnings
##
##
## CREATE TABLE t1 (f1 INTEGER);
## CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
## CREATE PROCEDURE p1 () DROP TRIGGER tr1;
##
##
## CALL p1 ();
## --error ER_TRG_DOES_NOT_EXIST
## CALL p1 ();
##
##
## DROP TABLE t1;
## DROP PROCEDURE p1;
##
##
## --echo #
## --echo # Bug#50423: Crash on second call of a procedure dropping a trigger
## --echo #
##
##
## --disable_warnings
## DROP TABLE IF EXISTS t1;
## DROP TRIGGER IF EXISTS tr1;
## DROP PROCEDURE IF EXISTS p1;
## --enable_warnings
##
##
## CREATE TABLE t1 (f1 INTEGER);
## CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET @aux = 1;
## CREATE PROCEDURE p1 () DROP TRIGGER tr1;
##
##
## CALL p1 ();
## --error ER_TRG_DOES_NOT_EXIST
## CALL p1 ();
##
##
## DROP TABLE t1;
## DROP PROCEDURE p1;
@ -164,8 +164,8 @@ DROP DATABASE db1;
DROP DATABASE db2;
--echo #
--echo # Bug#13105873:valgrind warning:possible crash in foreign
--echo # key handling on subsequent create table if not exists
--echo # Bug#13105873:valgrind warning:possible crash in foreign
--echo # key handling on subsequent create table if not exists
--echo #
## oceanbase not support foreign key yet!
@ -184,7 +184,7 @@ DROP DATABASE db2;
## DELIMITER ;$
## CALL p1();
## --echo # below stmt should not return valgrind warnings
## CALL p1();
## CALL p1();
## DROP DATABASE testdb;
## USE test;
@ -237,7 +237,7 @@ CALL TESTP_bug11763507();
#SHOW CREATE PROCEDURE testp_bug11763507;
#SHOW CREATE PROCEDURE TESTP_bug11763507;
# INFORMATION SCHEMA
# INFORMATION SCHEMA
SELECT specific_name FROM INFORMATION_SCHEMA.ROUTINES WHERE specific_name LIKE 'testf_bug11763507';
SELECT specific_name FROM INFORMATION_SCHEMA.ROUTINES WHERE specific_name LIKE 'TESTF_bug11763507';

View File

@ -1,6 +1,6 @@
# owner: linlin.xll
# owner group: SQL1
# description:
# description:
#tags: pl
--disable_query_log
@ -62,3 +62,4 @@ select * from t3 order by f asc|
drop table t3|
drop procedure fib|
set @@max_sp_recursion_depth= 0|

View File

@ -266,7 +266,7 @@ BEGIN
WHILE i > 0 DO
INSERT INTO t1(log_msg) VALUES(CONCAT('p1: case1: case2: loop: i: ', i));
CASE MOD(i, 2)
WHEN 0 THEN
INSERT INTO t1(log_msg) VALUES('p1: case1: case2: loop: i is even');
@ -275,7 +275,7 @@ BEGIN
ELSE
INSERT INTO t1(log_msg) VALUES('p1: case1: case2: loop: ERROR');
END CASE;
SET i = i - 1;
END WHILE;
END;
@ -310,7 +310,7 @@ BEGIN
WHILE i > 0 DO
INSERT INTO t1(log_msg) VALUES(CONCAT('p1: case4: case5: loop: i: ', i));
CASE MOD(i, 2)
WHEN 0 THEN
INSERT INTO t1(log_msg) VALUES('p1: case4: case5: loop: i is even');
@ -319,7 +319,7 @@ BEGIN
ELSE
INSERT INTO t1(log_msg) VALUES('p1: case4: case5: loop: ERROR');
END CASE;
SET i = i - 1;
END WHILE;
END;
@ -505,7 +505,7 @@ DROP PROCEDURE p1;
## DROP TABLE t1;
## END|
## delimiter ;|
##
##
## CALL p1(NOW());
## CALL p1('test');
@ -741,7 +741,7 @@ CALL p2();
CALL p3();
--error ER_DATA_TOO_LONG
CALL p4('aaa');
CALL p4('aaa');
--error ER_DATA_TOO_LONG
CALL p5('aa');
--error ER_WARN_DATA_OUT_OF_RANGE
@ -1088,30 +1088,30 @@ DROP TABLE t1;
# Test case.
#
## delimiter |;
##
##
## CREATE PROCEDURE p1(arg ENUM('a', 'b'))
## BEGIN
## SELECT arg;
## END|
##
##
## CREATE PROCEDURE p2(arg ENUM('a', 'b'))
## BEGIN
## DECLARE var ENUM('c', 'd') DEFAULT arg;
##
##
## SELECT arg, var;
## END|
##
##
## CREATE FUNCTION f1(arg ENUM('a', 'b')) RETURNS ENUM('c', 'd')
## BEGIN
## RETURN arg;
## END|
##
##
## delimiter ;|
##
##
## CALL p1('c');
##
##
## CALL p2('a');
##
##
## SELECT f1('a');
#
@ -1430,7 +1430,7 @@ CREATE PROCEDURE bug27415_text_test2(entity_id_str_in VARCHAR(255))
BEGIN
DECLARE str_remainder VARCHAR(255);
DECLARE str_remainder2 VARCHAR(255);
SET str_remainder2 = entity_id_str_in;
select 'before substr', str_remainder2;
SET str_remainder = SUBSTRING(str_remainder2, 3);
@ -1458,7 +1458,7 @@ drop table if exists t1;
--enable_warnings
delimiter |;
create function f1() returns int
create function f1() returns int
begin
if @a=1 then set @b='abc';
else set @b=1;

View File

@ -1172,7 +1172,7 @@ select f1(), f3()|
select id, f1(), f3() from t1 order by id|
# Function which uses two different tables
create function f4() returns double
create function f4() returns double
return (select d from t1, t2 where t1.data = t2.i and t1.id= "b")|
select f4()|
@ -1197,7 +1197,7 @@ select f5(2)|
--error 1424
select f5(3)|
# OTOH this should work
# OTOH this should work
create function f6() returns int
begin
declare n int;
@ -1303,8 +1303,8 @@ unlock tables|
#
# Unlike for permanent tables we should be able to create, use
# and drop such tables in functions.
#
# Simplest function using temporary table. It is also test case for bug
#
# Simplest function using temporary table. It is also test case for bug
# #12198 "Temporary table aliasing does not work inside stored functions"
#--error 1422
#create function f9() returns int
@ -1318,7 +1318,7 @@ unlock tables|
# return a + b;
#end|
## This will emit warning as t3 was not existing before.
#--error 1305
#--error 1305
#select f9()|
#--error 1305
#select f9() from t1 limit 1|
@ -1767,7 +1767,7 @@ create procedure h_se()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_se';
begin
@ -1782,12 +1782,12 @@ create procedure h_ss()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_ss';
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
declare continue handler for sqlstate '23000'
select 'Inner (good)' as 'h_ss';
insert into t3 values (1);
@ -1798,7 +1798,7 @@ create procedure h_sn()
deterministic
begin
-- Note: '02000' is more specific than NOT FOUND ;
-- there might be other not found states
-- there might be other not found states
declare continue handler for sqlstate '02000' -- no data
select 'Outer (bad)' as 'h_sn';
@ -1832,7 +1832,7 @@ create procedure h_sx()
deterministic
begin
-- integrity constraint violation
declare continue handler for sqlstate '23000'
declare continue handler for sqlstate '23000'
select 'Outer (bad)' as 'h_sx';
begin
@ -2127,7 +2127,7 @@ drop procedure if exists bug1862|
--error 1064
create procedure bug1862()
begin
insert into t3 values(2);
insert into t3 values(2);
flush tables;
end|
@ -2334,7 +2334,7 @@ insert into t3 values (123456789012)|
drop procedure if exists bug2780|
create procedure bug2780()
begin
declare exit handler for sqlwarning set @x = 1;
declare exit handler for sqlwarning set @x = 1;
set @x = 0;
insert into t3 values (123456789012);
@ -2360,7 +2360,7 @@ drop table t3|
#drop procedure if exists bug1863|
#
#create procedure bug1863(in1 int)
#begin
#begin
#
# declare ind int default 0;
# declare t1 int;
@ -2398,13 +2398,13 @@ drop table t3|
# BUG#2656
#
create table t3 (
create table t3 (
OrderID int not null,
MarketID int,
primary key (OrderID)
)|
create table t4 (
create table t4 (
MarketID int not null,
Market varchar(60),
Status char(1),
@ -2419,24 +2419,24 @@ insert t4 (MarketID,Market,Status) values (2,"MarketID Two","A")|
--disable_warnings ONCE
drop procedure if exists bug2656_1|
create procedure bug2656_1()
begin
begin
select
m.Market
from t4 m JOIN t3 o
from t4 m JOIN t3 o
ON o.MarketID != 1 and o.MarketID = m.MarketID;
end |
--disable_warnings ONCE
drop procedure if exists bug2656_2|
create procedure bug2656_2()
begin
begin
select
m.Market
from
from
t4 m, t3 o
where
where
m.MarketID != 1 and m.MarketID = o.MarketID;
end |
call bug2656_1()|
@ -2729,7 +2729,7 @@ drop function bug3788|
create function bug3788() returns binary(1) return 5|
select bug3788()|
drop function bug3788|
#
# BUG#4726
@ -2852,7 +2852,7 @@ create procedure bug4904 ()
begin
declare continue handler for sqlstate 'HY000' begin end;
select s1 from t3 union select s2 from t3;
select s1 from t3 union select s2 from t3;
end|
call bug4904()|
@ -3103,7 +3103,7 @@ begin
insert into t3 values (1);
insert into t3 values (1,2);
end|
create table t3 (s1 int, primary key (s1))|
insert into t3 values (1)|
call bug6029()|
@ -3230,7 +3230,7 @@ drop table t3|
#
# BUG#6857: current_time() in STORED PROCEDURES
#
--disable_warnings
--disable_warnings
drop procedure if exists bug6857|
--enable_warnings
create procedure bug6857()
@ -3343,7 +3343,7 @@ delimiter ;|
# BUG#8849: problem with insert statement with table alias's
#
# Rolling back changes to AND/OR structure of ON and WHERE clauses in SP
#
#
delimiter |;
--disable_warnings ONCE
@ -3450,25 +3450,25 @@ create procedure bug9074()
begin
declare x1, x2, x3, x4, x5, x6 int default 0;
begin
declare continue handler for sqlstate '23000' set x5 = 1;
begin
declare continue handler for sqlstate '23000' set x5 = 1;
insert into t3 values ('a', 'b');
set x6 = 1;
insert into t3 values ('a', 'b');
set x6 = 1;
end;
begin1_label:
begin
declare continue handler for sqlstate '23000' set x1 = 1;
insert into t3 values ('a', 'b');
set x2 = 1;
declare continue handler for sqlstate '23000' set x1 = 1;
insert into t3 values ('a', 'b');
set x2 = 1;
begin2_label:
begin
declare exit handler for sqlstate '23000' set x3 = 1;
begin
declare exit handler for sqlstate '23000' set x3 = 1;
set x4= 1;
set x4= 1;
insert into t3 values ('a','b');
set x4= 0;
end begin2_label;
@ -3730,16 +3730,16 @@ drop procedure bug9004_2|
#
--disable_warnings ONCE
drop procedure if exists bug7293|
insert into t1 values ('secret', 0)|
insert into t1 values ('secret', 0)|
create procedure bug7293(p1 varchar(100))
begin
if exists (select id from t1 where soundex(p1)=soundex(id)) then
select 'yes';
end if;
end;|
end;|
call bug7293('secret')|
call bug7293 ('secrete')|
call bug7293('secret')|
call bug7293 ('secrete')|
drop procedure bug7293|
delete from t1|
@ -3755,7 +3755,7 @@ drop view if exists v1|
create view v1 as select * from t1, t2 where id = s|
create procedure bug9841 ()
update v1 set data = 10|
update v1 set data = 10|
call bug9841()|
drop view v1|
@ -3779,15 +3779,15 @@ drop procedure bug5963_1|
drop table t3|
create procedure bug5963_2 (cfk_value int)
begin
if cfk_value in (select cpk from t3) then
set @x = 5;
end if;
end;
|
create table t3 (cpk int)|
insert into t3 values (1)|
create procedure bug5963_2 (cfk_value int)
begin
if cfk_value in (select cpk from t3) then
set @x = 5;
end if;
end;
|
create table t3 (cpk int)|
insert into t3 values (1)|
call bug5963_2(1)|
call bug5963_2(1)|
@ -4033,16 +4033,16 @@ create table t3 (c1 varchar(5), c2 char(5), c3 enum('one','two'), c4 text, c5 bl
insert into t3 values ('', '', '', '', '', '', NULL)|
create procedure bug8692()
begin
declare v1 VARCHAR(10);
declare v2 VARCHAR(10);
declare v3 VARCHAR(10);
declare v4 VARCHAR(10);
declare v5 VARCHAR(10);
declare v6 VARCHAR(10);
declare v7 VARCHAR(10);
declare c8692 cursor for select c1,c2,c3,c4,c5,c6,c7 from t3;
open c8692;
begin
declare v1 VARCHAR(10);
declare v2 VARCHAR(10);
declare v3 VARCHAR(10);
declare v4 VARCHAR(10);
declare v5 VARCHAR(10);
declare v6 VARCHAR(10);
declare v7 VARCHAR(10);
declare c8692 cursor for select c1,c2,c3,c4,c5,c6,c7 from t3;
open c8692;
fetch c8692 into v1,v2,v3,v4,v5,v6,v7;
select v1, v2, v3, v4, v5, v6, v7;
end|
@ -4196,7 +4196,7 @@ drop procedure if exists bug11333|
create table t3 (c1 char(128))|
insert into t3 values
insert into t3 values
('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA')|
@ -4746,7 +4746,7 @@ create procedure bug10100p(prm int, inout res int)
begin
set res = res * prm;
if prm > 1 then
call bug10100p(prm - 1, res);
call bug10100p(prm - 1, res);
end if;
end|
create procedure bug10100t(prm int)
@ -4955,10 +4955,10 @@ begin
insert into t4 set a=null;
insert into t4 set a=null;
insert into t4 select null as a;
insert into t3 set a=null;
insert into t3 set a=null;
select * from t3;
end|
@ -5008,7 +5008,7 @@ drop procedure bug14376|
#
# Bug#5967 "Stored procedure declared variable used instead of column"
# The bug should be fixed later.
# Test precedence of names of parameters, variable declarations,
# Test precedence of names of parameters, variable declarations,
# variable declarations in nested compound statements, table columns,
# table columns in cursor declarations.
# According to the standard, table columns take precedence over
@ -5102,7 +5102,7 @@ select * from t1 order by data|
#
# A test case for Bug#15392 "Server crashes during prepared statement
# execute": make sure that stored procedure check for error conditions
# properly and do not continue execution if an error has been set.
# properly and do not continue execution if an error has been set.
#
# It's necessary to use several DBs because in the original code
# the successful return of mysql_change_db overrode the error from
@ -5290,7 +5290,7 @@ drop procedure if exists bug15231_6|
--enable_warnings
create table t3 (id int not null)|
create procedure bug15231_1()
begin
declare xid integer;
@ -5404,7 +5404,7 @@ insert into t3 values
create procedure bug17476(pDateFormat varchar(10))
select date_format(t3.d, pDateFormat), count(*)
from t3
from t3
group by date_format(t3.d, pDateFormat)|
call bug17476('%Y-%m')|
@ -5486,7 +5486,7 @@ begin
select id from t1 order by x, id;
end|
#
#
# BUG#14945: Truncate table doesn't reset the auto_increment counter
#
--disable_warnings ONCE
@ -5564,28 +5564,28 @@ drop procedure bug18787|
# (... if the database name is longer than 21 characters)
#
# 1234567890123456789012
create database bug18344_012345678901|
create database bug18344_012345678901|
use bug18344_012345678901|
create procedure bug18344() begin end|
create procedure bug18344_2() begin end|
create database bug18344_0123456789012|
create database bug18344_0123456789012|
use bug18344_0123456789012|
create procedure bug18344() begin end|
create procedure bug18344_2() begin end|
use test|
select schema_name from information_schema.schemata where
select schema_name from information_schema.schemata where
schema_name like 'bug18344%'|
select routine_name,routine_schema from information_schema.routines where
routine_schema like 'bug18344%'|
drop database bug18344_012345678901|
drop database bug18344_0123456789012|
drop database bug18344_012345678901|
drop database bug18344_0123456789012|
# Should be nothing left.
select schema_name from information_schema.schemata where
select schema_name from information_schema.schemata where
schema_name like 'bug18344%'|
select routine_name,routine_schema from information_schema.routines where
routine_schema like 'bug18344%'|
@ -5605,7 +5605,7 @@ create function bug12472() returns int return (select count(*) from t1)|
show create table t3|
--error 1146
select * from t3|
--error 1051
--error 1051
drop table t3|
# Check case when function is used indirectly through view
create view v1 as select bug12472() as j|
@ -5742,7 +5742,7 @@ create database mysqltest1 charset=utf8|
create database mysqltest2 charset=utf8|
create procedure mysqltest1.p1()
begin
-- alters the default collation of database test
-- alters the default collation of database test
alter database character set koi8r;
end|
use mysqltest1|
@ -6128,7 +6128,7 @@ DROP FUNCTION bug19862|
# Bug#21002 "Derived table not selecting from a "real" table fails in JOINs"
#
#
# A regression caused by the fix for Bug#18444: for derived tables we should
# set an empty string as the current database. They do not belong to any
# database and must be usable even if there is no database
@ -6227,7 +6227,7 @@ drop database това_е_дълго_име_за_база_данни_нали|
#
# BUG#21493: Crash on the second call of a procedure containing
# a select statement that uses an IN aggregating subquery
# a select statement that uses an IN aggregating subquery
#
CREATE TABLE t3 (
@ -6277,7 +6277,7 @@ CREATE FUNCTION bug21493(paramMember VARCHAR(15)) RETURNS varchar(45)
BEGIN
DECLARE tracks VARCHAR(45);
SELECT GROUP_CONCAT(Track SEPARATOR ', ') FROM t4
WHERE Member_ID=paramMember AND Action='Enrolled' AND
WHERE Member_ID=paramMember AND Action='Enrolled' AND
(Track,Action_Date) IN (SELECT Track, MAX(Action_Date) FROM t4
WHERE Member_ID=paramMember GROUP BY Track) INTO tracks;
RETURN tracks;
@ -6460,7 +6460,7 @@ drop procedure proc_21462_b|
#
# Bug#19733 "Repeated alter, or repeated create/drop, fails"
# Check that CREATE/DROP INDEX is re-execution friendly.
#
#
--disable_warnings
drop table if exists t3|
drop procedure if exists proc_bug19733|
@ -6489,7 +6489,7 @@ drop table t3|
#
# BUG#20492: Subsequent calls to stored procedure yeild incorrect
# result if join is used
# result if join is used
#
# Optimized ON expression in join wasn't properly saved for reuse.
#
@ -6664,14 +6664,14 @@ DROP FUNCTION IF EXISTS bug23760_rc_test|
CREATE TABLE bug23760 (
id INT NOT NULL AUTO_INCREMENT ,
num INT NOT NULL ,
PRIMARY KEY ( id )
PRIMARY KEY ( id )
)|
CREATE TABLE bug23760_log (
id INT NOT NULL AUTO_INCREMENT ,
reason VARCHAR(50)NULL ,
ammount INT NOT NULL ,
PRIMARY KEY ( id )
PRIMARY KEY ( id )
)|
CREATE PROCEDURE bug23760_update_log(r Varchar(50), a INT)
@ -6794,7 +6794,7 @@ begin
else set x:= x+100;
end case;
set x:=x + 500;
return x;
end|
@ -6954,7 +6954,7 @@ SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY f1 WITH ROLLUP|
DROP FUNCTION bug25373|
DROP TABLE t3|
#todo:
#todo:
#这里等共享表达式提交之后再将这个case补上
#SELECT SUM(f2), bug25373(f1) FROM t3 GROUP BY bug25373(f1) WITH ROLLUP
@ -7028,14 +7028,14 @@ select bug20777(18446744073709551616) as 'upper bounds unsigned bigint + 1';
--error 1264
select bug20777(-1) as 'lower bounds unsigned bigint - 1';
--error 1264
create table examplebug20777 as select
create table examplebug20777 as select
0 as 'i',
bug20777(9223372036854775806) as '2**63-2',
bug20777(9223372036854775807) as '2**63-1',
bug20777(9223372036854775808) as '2**63',
bug20777(9223372036854775809) as '2**63+1',
bug20777(18446744073709551614) as '2**64-2',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551615) as '2**64-1',
bug20777(18446744073709551616) as '2**64';
#insert into examplebug20777 values (1, 9223372036854775806, 9223372036854775807, 223372036854775808, 9223372036854775809, 18446744073709551614, 18446744073709551615, 8446744073709551616);
@ -7077,7 +7077,7 @@ BEGIN
RETURN v2;
END|
SELECT bug5274_f2()|
# Cleanup.
@ -7150,7 +7150,7 @@ drop function bug27354;
# Bug #28605: SHOW CREATE VIEW with views using stored_procedures no longer
# showing SP names.
#
CREATE TABLE t1 (a INT);
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
CREATE FUNCTION metered(a INT) RETURNS INT RETURN 12;
@ -7258,7 +7258,7 @@ drop procedure if exists test.sp_bug29050;
create database mysqltest_db1;
use mysqltest_db1;
# For the sake of its side effect
drop database mysqltest_db1;
drop database mysqltest_db1;
# Now we have no current database selected.
create table test.t1 (id int);
insert into test.t1 (id) values (1);
@ -7419,16 +7419,16 @@ begin
set x=-1;
return x;
end|
delimiter ;|
create view v1 as select 1 as one, f1() as days;
connect (bug29408,$OBMYSQL_MS0,root@mysql, ,*NO-ONE*,$OBMYSQL_PORT);
connection bug29408;
--source mysql_test/include/show_create_table_old_version_replica2.inc
show create view test.v1;
show create view test.v1;
select column_name from information_schema.columns
where table_name='v1' and table_schema='test';
@ -7951,7 +7951,7 @@ drop view v1;
drop table t1;
#
# Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar
# Bug#38469 invalid memory read and/or crash with utf8 text field, stored procedure, uservar
#
delimiter $;
--disable_warnings ONCE
@ -8221,15 +8221,15 @@ DROP TABLE t1;
#DROP VIEW t3;
#
#--echo #
#--echo # Bug #46629: Item_in_subselect::val_int(): Assertion `0'
#--echo # Bug #46629: Item_in_subselect::val_int(): Assertion `0'
#--echo # on subquery inside a SP
#--echo #
#CREATE TABLE t1(a INT);
#CREATE TABLE t2(a INT, b INT PRIMARY KEY);
#
#DELIMITER |;
#CREATE PROCEDURE p1 ()
#BEGIN
#CREATE PROCEDURE p1 ()
#BEGIN
# SELECT a FROM t1 A WHERE A.b IN (SELECT b FROM t2 AS B);
#END|
#DELIMITER ;|
@ -8500,7 +8500,7 @@ DROP FUNCTION f4;
DROP TABLE t1;
--echo #
--echo # Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non
--echo # Bug#34197: CREATE PROCEDURE fails when COMMENT truncated in non
--echo # strict SQL mode
--echo #
@ -8540,7 +8540,7 @@ DROP PROCEDURE p1;
#CREATE TEMPORARY TABLE t1 (f1 INT);
#
#--echo # t1 still refers to the view since it was inlined
#--echo #
#--echo #
##--error ER_NON_INSERTABLE_TABLE
#CALL p1(2);
#
@ -8654,7 +8654,7 @@ drop procedure p1;
create procedure p1(p1 integer, p2 integer)
select * from t1 limit a, b;
--echo #
--echo # Try to use data types not allowed in LIMIT
--echo # Try to use data types not allowed in LIMIT
--echo #
#--error ER_WRONG_SPVAR_TYPE_IN_LIMIT
drop procedure p1;
@ -8724,7 +8724,7 @@ drop function f1;
delimiter |;
--echo #
--echo # Try to use data types not allowed in LIMIT
--echo # Try to use data types not allowed in LIMIT
--echo #
create function f1(p1 date, p2 date)
returns int
@ -8813,10 +8813,10 @@ drop table t1;
drop procedure p1;
drop function f1;
--echo #
--echo # BUG#11766234: 59299: ASSERT (TABLE_REF->TABLE || TABLE_REF->VIEW)
--echo #
--echo # BUG#11766234: 59299: ASSERT (TABLE_REF->TABLE || TABLE_REF->VIEW)
--echo # FAILS IN SET_FIELD_ITERATOR
--echo #
--echo #
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (a INT);
@ -8842,7 +8842,7 @@ DROP PROCEDURE proc;
--echo # --
--echo # -- Bug 11765684 - 58674: SP-cache does not detect changes in
--echo # -- pre-locking list caused by triggers
--echo # ---
--echo # ---
--disable_warnings
DROP TABLE IF EXISTS t1;
@ -8884,7 +8884,7 @@ DROP PROCEDURE p1;
--echo # --
--echo # -- Bug#12652769 - 61470: case operator in stored routine retains old
--echo # -- value of input parameter
--echo # ---
--echo # ---
--disable_warnings
DROP TABLE IF EXISTS t1;
@ -8942,20 +8942,20 @@ DROP PROCEDURE p1;
--disable_warnings
DROP TABLE IF EXISTS t1;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p1;
DROP PROCEDURE IF EXISTS p2;
--enable_warnings
CREATE TABLE t1 (c1 INT);
CREATE TABLE t1 (c1 INT);
INSERT INTO t1 VALUES (1);
delimiter |;
CREATE PROCEDURE p1()
BEGIN
DECLARE foo, cnt INT UNSIGNED DEFAULT 1;
SET foo = (SELECT MIN(c1) FROM t1 LIMIT cnt);
END|
CREATE PROCEDURE p1()
BEGIN
DECLARE foo, cnt INT UNSIGNED DEFAULT 1;
SET foo = (SELECT MIN(c1) FROM t1 LIMIT cnt);
END|
CREATE PROCEDURE p2()
BEGIN
@ -9041,7 +9041,7 @@ BEGIN
END;
END;
RETURN 1;
END $
END $
delimiter ;$
# This used to cause an assertion.