mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge kboortz@bk-internal.mysql.com:/home/bk/mysql-5.0
into mysql.com:/Users/kent/mysql/bk/mysql-5.0-new
This commit is contained in:
@ -729,6 +729,24 @@ select * from t1 where bob is null and cip=1;
|
||||
cip time score bob
|
||||
1 00:01:00 0 NULL
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
id1 int not null auto_increment,
|
||||
id2 int not null default '0',
|
||||
t text not null,
|
||||
primary key (id1),
|
||||
key x (id2, t(32))
|
||||
) engine=myisam;
|
||||
insert into t1 (id2, t) values
|
||||
(10, 'abc'), (10, 'abc'), (10, 'abc'),
|
||||
(20, 'abc'), (20, 'abc'), (20, 'def'),
|
||||
(10, 'abc'), (10, 'abc');
|
||||
select count(*) from t1 where id2 = 10;
|
||||
count(*)
|
||||
5
|
||||
select count(id1) from t1 where id2 = 10;
|
||||
count(id1)
|
||||
5
|
||||
drop table t1;
|
||||
set storage_engine=MyISAM;
|
||||
drop table if exists t1,t2,t3;
|
||||
--- Testing varchar ---
|
||||
|
@ -2210,12 +2210,12 @@ UNLOCK TABLES;
|
||||
DELIMITER ;;
|
||||
/*!50003 DROP FUNCTION IF EXISTS `bug9056_func1` */;;
|
||||
/*!50003 SET SESSION SQL_MODE=""*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func1`(a INT, b INT) RETURNS int(11)
|
||||
RETURN a+b */;;
|
||||
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
|
||||
/*!50003 DROP FUNCTION IF EXISTS `bug9056_func2` */;;
|
||||
/*!50003 SET SESSION SQL_MODE=""*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1)
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 FUNCTION `bug9056_func2`(f1 char binary) RETURNS char(1)
|
||||
begin
|
||||
set f1= concat( 'hello', f1 );
|
||||
return f1;
|
||||
@ -2223,17 +2223,17 @@ end */;;
|
||||
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
|
||||
/*!50003 DROP PROCEDURE IF EXISTS `a'b` */;;
|
||||
/*!50003 SET SESSION SQL_MODE="REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI"*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER="root"@"localhost"*/ /*!50003 PROCEDURE "a'b"()
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER="root"@"localhost"*/ /*!50003 PROCEDURE "a'b"()
|
||||
select 1 */;;
|
||||
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
|
||||
/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc1` */;;
|
||||
/*!50003 SET SESSION SQL_MODE=""*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc1`(IN a INT, IN b INT, OUT c INT)
|
||||
BEGIN SELECT a+b INTO c; end */;;
|
||||
/*!50003 SET SESSION SQL_MODE=@OLD_SQL_MODE*/;;
|
||||
/*!50003 DROP PROCEDURE IF EXISTS `bug9056_proc2` */;;
|
||||
/*!50003 SET SESSION SQL_MODE=""*/;;
|
||||
/*!50003 CREATE*/ /*!50019 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc2`(OUT a INT)
|
||||
/*!50003 CREATE*/ /*!50020 DEFINER=`root`@`localhost`*/ /*!50003 PROCEDURE `bug9056_proc2`(OUT a INT)
|
||||
BEGIN
|
||||
select sum(id) from t1 into a;
|
||||
END */;;
|
||||
|
@ -1,30 +1,60 @@
|
||||
drop table if exists t1,v1;
|
||||
drop view if exists t1,v1;
|
||||
drop procedure if exists f1;
|
||||
use test;
|
||||
create procedure f1() select 1;
|
||||
drop procedure f1;
|
||||
create table t1 (a int);
|
||||
create definer='user'@'host' sql security definer view v1 as select * from t1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
drop function if exists f1;
|
||||
Warnings:
|
||||
Note 1305 FUNCTION f1 does not exist
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP VIEW IF EXISTS v2;
|
||||
DROP VIEW IF EXISTS v3;
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP FUNCTION IF EXISTS f3;
|
||||
CREATE TABLE t1(c INT);
|
||||
CREATE TRIGGER t1_bi BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @a = 1;
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
CREATE PROCEDURE p1()
|
||||
SELECT 1;
|
||||
CREATE FUNCTION f1() RETURNS INT
|
||||
RETURN 1;
|
||||
CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @b = 1;
|
||||
CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
|
||||
CREATE DEFINER=a@b PROCEDURE p2()
|
||||
SELECT 2;
|
||||
CREATE DEFINER=a@b FUNCTION f2() RETURNS INT
|
||||
RETURN 2;
|
||||
CREATE DEFINER=a@'' TRIGGER ti_bu BEFORE UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @c = 1;
|
||||
CREATE DEFINER=a@'' VIEW v3 AS SELECT * FROM t1;
|
||||
CREATE DEFINER=a@'' PROCEDURE p3()
|
||||
SELECT 3;
|
||||
CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
|
||||
RETURN 3;
|
||||
SHOW CREATE VIEW v3;
|
||||
View Create View
|
||||
v3 CREATE ALGORITHM=UNDEFINED DEFINER=`a`@`` SQL SECURITY DEFINER VIEW `v3` AS select `t1`.`c` AS `c` from `t1`
|
||||
SHOW CREATE PROCEDURE p3;
|
||||
Procedure sql_mode Create Procedure
|
||||
p3 CREATE DEFINER=`a`@`` PROCEDURE `p3`()
|
||||
SELECT 3
|
||||
SHOW CREATE FUNCTION f3;
|
||||
Function sql_mode Create Function
|
||||
f3 CREATE DEFINER=`a`@`` FUNCTION `f3`() RETURNS int(11)
|
||||
RETURN 3
|
||||
DROP TRIGGER t1_bi;
|
||||
DROP TRIGGER ti_ai;
|
||||
DROP TRIGGER ti_bu;
|
||||
DROP VIEW v1;
|
||||
DROP VIEW v2;
|
||||
DROP VIEW v3;
|
||||
DROP TABLE t1;
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p3;
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP FUNCTION f3;
|
||||
|
@ -2197,35 +2197,6 @@ select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
|
||||
2 01-01-1970 03:16:40
|
||||
drop procedure bug3426|
|
||||
create table t3 (
|
||||
a int primary key,
|
||||
ach char(1)
|
||||
) engine = innodb|
|
||||
create table t4 (
|
||||
b int primary key ,
|
||||
bch char(1)
|
||||
) engine = innodb|
|
||||
insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'ach' at row 1
|
||||
Warning 1265 Data truncated for column 'ach' at row 2
|
||||
insert into t4 values (1 , 'bCh1' )|
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'bch' at row 1
|
||||
drop procedure if exists bug3448|
|
||||
create procedure bug3448()
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
call bug3448()|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
call bug3448()|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
drop procedure bug3448|
|
||||
drop table t3, t4|
|
||||
create table t3 (
|
||||
id int unsigned auto_increment not null primary key,
|
||||
title VARCHAR(200),
|
||||
body text,
|
||||
@ -4005,48 +3976,6 @@ DROP VIEW bug13095_v1
|
||||
DROP PROCEDURE IF EXISTS bug13095;
|
||||
DROP VIEW IF EXISTS bug13095_v1;
|
||||
DROP TABLE IF EXISTS bug13095_t1;
|
||||
drop procedure if exists bug14210|
|
||||
set @@session.max_heap_table_size=16384|
|
||||
select @@session.max_heap_table_size|
|
||||
@@session.max_heap_table_size
|
||||
16384
|
||||
create table t3 (a char(255)) engine=InnoDB|
|
||||
create procedure bug14210_fill_table()
|
||||
begin
|
||||
declare table_size, max_table_size int default 0;
|
||||
select @@session.max_heap_table_size into max_table_size;
|
||||
delete from t3;
|
||||
insert into t3 (a) values (repeat('a', 255));
|
||||
repeat
|
||||
insert into t3 select a from t3;
|
||||
select count(*)*255 from t3 into table_size;
|
||||
until table_size > max_table_size*2 end repeat;
|
||||
end|
|
||||
call bug14210_fill_table()|
|
||||
drop procedure bug14210_fill_table|
|
||||
create table t4 like t3|
|
||||
create procedure bug14210()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from t3;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
insert into t4 values (upper(a));
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14210()|
|
||||
select count(*) from t4|
|
||||
count(*)
|
||||
256
|
||||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
drop function if exists bug14723|
|
||||
drop procedure if exists bug14723|
|
||||
/*!50003 create function bug14723()
|
||||
@ -4857,4 +4786,20 @@ i
|
||||
0
|
||||
drop table t3|
|
||||
drop procedure bug16887|
|
||||
create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
|
||||
insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
|
||||
CREATE FUNCTION bug13575 ( p1 integer )
|
||||
returns varchar(3)
|
||||
BEGIN
|
||||
DECLARE v1 VARCHAR(10) DEFAULT null;
|
||||
SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
|
||||
RETURN v1;
|
||||
END|
|
||||
select distinct f1, bug13575(f1) from t3 order by f1|
|
||||
f1 bug13575(f1)
|
||||
1 aaa
|
||||
2 bbb
|
||||
3 ccc
|
||||
drop function bug13575;
|
||||
drop table t3|
|
||||
drop table t1,t2;
|
||||
|
@ -425,3 +425,108 @@ x y
|
||||
drop procedure bug14840_1|
|
||||
drop procedure bug14840_2|
|
||||
drop table t3|
|
||||
drop procedure if exists bug10656_create_index|
|
||||
drop procedure if exists bug10656_myjoin|
|
||||
drop procedure if exists bug10656_truncate_table|
|
||||
CREATE TABLE t3 (
|
||||
`ID` int(11) default NULL,
|
||||
`txt` char(5) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1|
|
||||
INSERT INTO t3 (`ID`,`txt`) VALUES
|
||||
(1,'a'), (2,'b'), (3,'c'), (4,'d')|
|
||||
CREATE TABLE t4 (
|
||||
`ID` int(11) default NULL,
|
||||
`txt` char(5) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1|
|
||||
INSERT INTO t4 (`ID`,`txt`) VALUES
|
||||
(1,'a'), (2,'b'), (3,'c'), (4,'d')|
|
||||
create procedure bug10656_create_index()
|
||||
begin
|
||||
create index bug10656_my_index on t3 (ID);
|
||||
end|
|
||||
call bug10656_create_index()|
|
||||
create procedure bug10656_myjoin()
|
||||
begin
|
||||
update t3, t4 set t3.txt = t4.txt where t3.id = t4.id;
|
||||
end|
|
||||
call bug10656_myjoin()|
|
||||
create procedure bug10656_truncate_table()
|
||||
begin
|
||||
truncate table t3;
|
||||
end|
|
||||
call bug10656_truncate_table()|
|
||||
drop procedure bug10656_create_index|
|
||||
drop procedure bug10656_myjoin|
|
||||
drop procedure bug10656_truncate_table|
|
||||
drop table t3, t4|
|
||||
create table t3 (
|
||||
a int primary key,
|
||||
ach char(1)
|
||||
) engine = innodb|
|
||||
create table t4 (
|
||||
b int primary key,
|
||||
bch char(1)
|
||||
) engine = innodb|
|
||||
insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'ach' at row 1
|
||||
Warning 1265 Data truncated for column 'ach' at row 2
|
||||
insert into t4 values (1 , 'bCh1' )|
|
||||
Warnings:
|
||||
Warning 1265 Data truncated for column 'bch' at row 1
|
||||
drop procedure if exists bug3448|
|
||||
create procedure bug3448()
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
call bug3448()|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
call bug3448()|
|
||||
a ach b bch
|
||||
1 a 1 b
|
||||
drop procedure bug3448|
|
||||
drop table t3, t4|
|
||||
drop procedure if exists bug14210|
|
||||
set @@session.max_heap_table_size=16384|
|
||||
select @@session.max_heap_table_size|
|
||||
@@session.max_heap_table_size
|
||||
16384
|
||||
create table t3 (a char(255)) engine=InnoDB|
|
||||
create procedure bug14210_fill_table()
|
||||
begin
|
||||
declare table_size, max_table_size int default 0;
|
||||
select @@session.max_heap_table_size into max_table_size;
|
||||
delete from t3;
|
||||
insert into t3 (a) values (repeat('a', 255));
|
||||
repeat
|
||||
insert into t3 select a from t3;
|
||||
select count(*)*255 from t3 into table_size;
|
||||
until table_size > max_table_size*2 end repeat;
|
||||
end|
|
||||
call bug14210_fill_table()|
|
||||
drop procedure bug14210_fill_table|
|
||||
create table t4 like t3|
|
||||
create procedure bug14210()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from t3;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
insert into t4 values (upper(a));
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14210()|
|
||||
select count(*) from t4|
|
||||
count(*)
|
||||
256
|
||||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
|
@ -2539,3 +2539,17 @@ drop view v1;
|
||||
//
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_no_cache `test`.`t1`.`id` AS `id` from `t1`
|
||||
create table t1(f1 int, f2 int);
|
||||
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
|
||||
.f1 and ta.f2=tb.f2;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
create view v2 as select * from v1 where a > 1 with check option;
|
||||
select * from v2;
|
||||
a b
|
||||
2 2
|
||||
update v2 set b=3 where a=2;
|
||||
select * from v2;
|
||||
a b
|
||||
3 3
|
||||
drop view v2, v1;
|
||||
drop table t1;
|
||||
|
@ -520,11 +520,16 @@ use test;
|
||||
drop user mysqltest_1@localhost;
|
||||
drop database mysqltest;
|
||||
create definer=some_user@`` sql security invoker view v1 as select 1;
|
||||
ERROR HY000: Definer is not fully qualified
|
||||
create definer=some_user@localhost sql security invoker view v1 as select 1;
|
||||
Warnings:
|
||||
Note 1449 There is no 'some_user'@'' registered
|
||||
create definer=some_user@localhost sql security invoker view v2 as select 1;
|
||||
Warnings:
|
||||
Note 1449 There is no 'some_user'@'localhost' registered
|
||||
show create view v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1`
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`` SQL SECURITY INVOKER VIEW `v1` AS select 1 AS `1`
|
||||
show create view v2;
|
||||
View Create View
|
||||
v2 CREATE ALGORITHM=UNDEFINED DEFINER=`some_user`@`localhost` SQL SECURITY INVOKER VIEW `v2` AS select 1 AS `1`
|
||||
drop view v1;
|
||||
drop view v2;
|
||||
|
@ -678,6 +678,25 @@ select * from t1 where bob is null and cip=1;
|
||||
create index bug on t1 (bob(22), cip, time);
|
||||
select * from t1 where bob is null and cip=1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#14980 - COUNT(*) incorrect on MyISAM table with certain INDEX
|
||||
#
|
||||
create table t1 (
|
||||
id1 int not null auto_increment,
|
||||
id2 int not null default '0',
|
||||
t text not null,
|
||||
primary key (id1),
|
||||
key x (id2, t(32))
|
||||
) engine=myisam;
|
||||
insert into t1 (id2, t) values
|
||||
(10, 'abc'), (10, 'abc'), (10, 'abc'),
|
||||
(20, 'abc'), (20, 'abc'), (20, 'def'),
|
||||
(10, 'abc'), (10, 'abc');
|
||||
select count(*) from t1 where id2 = 10;
|
||||
select count(id1) from t1 where id2 = 10;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# $mysql_errno contains the return code of the last command
|
||||
# send to the server.
|
||||
# sent to the server.
|
||||
# ----------------------------------------------------------------------------
|
||||
# get $mysql_errno before the first statement
|
||||
# $mysql_errno should be -1
|
||||
@ -50,7 +50,7 @@ select otto from (select 1 as otto) as t1;
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Negative case(statement):
|
||||
# The dervied table t1 does not contain a column named 'friedrich' .
|
||||
# The derived table t1 does not contain a column named 'friedrich' .
|
||||
# --> ERROR 42S22: Unknown column 'friedrich' in 'field list and
|
||||
# --> 1054: Unknown column 'friedrich' in 'field list'
|
||||
# ----------------------------------------------------------------------------
|
||||
@ -68,7 +68,7 @@ select friedrich from (select 1 as otto) as t1;
|
||||
# The following unmasked unsuccessful statement must give
|
||||
# 1. mysqltest gives a 'failed'
|
||||
# 2. does not produce a r/<test case>.reject file !!!
|
||||
# PLEASE uncomment it and check it's effect
|
||||
# PLEASE uncomment it and check its effect
|
||||
#select friedrich from (select 1 as otto) as t1;
|
||||
|
||||
|
||||
@ -114,7 +114,7 @@ select friedrich from (select 1 as otto) as t1;
|
||||
# test cases for $mysql_errno
|
||||
#
|
||||
# $mysql_errno is a builtin variable of mysqltest and contains the return code
|
||||
# of the last command send to the server.
|
||||
# of the last command sent to the server.
|
||||
#
|
||||
# The following test cases often initialize $mysql_errno to 1064 by
|
||||
# a command with wrong syntax.
|
||||
@ -217,7 +217,7 @@ garbage ;
|
||||
execute stmt;
|
||||
eval select $mysql_errno as "after_successful_execute" ;
|
||||
|
||||
# failing execute (table dropped)
|
||||
# failing execute (table has been dropped)
|
||||
drop table t1;
|
||||
--error 1064
|
||||
garbage ;
|
||||
@ -249,8 +249,8 @@ eval select $mysql_errno as "after_failing_deallocate" ;
|
||||
# ----------------------------------------------------------------------------
|
||||
# test cases for "--disable_abort_on_error"
|
||||
#
|
||||
# "--disable_abort_on_error" switches the abort of mysqltest
|
||||
# after "unmasked" failing statements off.
|
||||
# "--disable_abort_on_error" switches off the abort of mysqltest
|
||||
# after "unmasked" failing statements.
|
||||
#
|
||||
# The default is "--enable_abort_on_error".
|
||||
#
|
||||
@ -258,13 +258,13 @@ eval select $mysql_errno as "after_failing_deallocate" ;
|
||||
# --error <error number> and --error <error number>
|
||||
# in the line before the failing statement.
|
||||
#
|
||||
# There are some additional test case for $mysql_errno
|
||||
# There are some additional test cases for $mysql_errno
|
||||
# because "--disable_abort_on_error" enables a new situation.
|
||||
# Example: "unmasked" statement fails + analysis of $mysql_errno
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Switch the abort on error off and check the effect on $mysql_errno
|
||||
# Switch off the abort on error and check the effect on $mysql_errno
|
||||
# ----------------------------------------------------------------------------
|
||||
--error 1064
|
||||
garbage ;
|
||||
@ -345,7 +345,7 @@ select 3 from t1 ;
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
# Test detect end of line "junk"
|
||||
# Most likely causes by a missing delimiter
|
||||
# Most likely caused by a missing delimiter
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
# Too many parameters to function
|
||||
@ -1043,7 +1043,7 @@ let $message= . Here comes a very very long message that
|
||||
--source include/show_msg80.inc
|
||||
|
||||
#
|
||||
# Test --enable_parsning / disable_parsning
|
||||
# Test --enable_parsing / disable_parsing
|
||||
#
|
||||
--disable_query_log
|
||||
--disable_parsing
|
||||
@ -1070,9 +1070,9 @@ select "this will be executed";
|
||||
|
||||
#
|
||||
# Test that mysqltest fails when there are no queries executed
|
||||
# but a result file exist
|
||||
# but a result file exists
|
||||
# NOTE! This will never happen as long as it's not allowed to have
|
||||
# test files that does not produce any output
|
||||
# test files that produce no output
|
||||
#--exec echo "something" > $MYSQLTEST_VARDIR/tmp/result_file.result
|
||||
#--exec echo "let \$i= 1;" > $MYSQLTEST_VARDIR/tmp/query.sql
|
||||
#--error 1
|
||||
|
@ -1,37 +1,18 @@
|
||||
# This tests not performed with embedded server
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,v1;
|
||||
drop view if exists t1,v1;
|
||||
drop procedure if exists f1;
|
||||
--enable_warnings
|
||||
use test;
|
||||
|
||||
#
|
||||
# Test that we can create and drop procedure without warnings
|
||||
# see bug#9993
|
||||
#
|
||||
create procedure f1() select 1;
|
||||
drop procedure f1;
|
||||
|
||||
#
|
||||
# BUG#13504: creation view with DEFINER clause if --skip-grant-tables
|
||||
#
|
||||
create table t1 (a int);
|
||||
create definer='user'@'host' sql security definer view v1 as select * from t1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
# BUG#17595: DROP FUNCTION IF EXISTS f1 crashes server
|
||||
drop function if exists f1;
|
||||
|
||||
#
|
||||
# BUG#16777: Can not create trigger nor view w/o definer if --skip-grant-tables
|
||||
# specified
|
||||
#
|
||||
# Also, a test that we can create VIEW if privileges check switched off has
|
||||
# been moved here.
|
||||
# Also, the following test cases have been moved here:
|
||||
# - test that we can create VIEW if privileges check switched off has been
|
||||
# moved here;
|
||||
# - test that we can create and drop procedure without warnings (BUG#9993);
|
||||
# - BUG#17595: "DROP FUNCTION IF EXISTS" crashes server;
|
||||
# - BUG#13504: creation view with DEFINER clause if --skip-grant-tables
|
||||
#
|
||||
|
||||
# Prepare.
|
||||
@ -40,33 +21,90 @@ drop function if exists f1;
|
||||
|
||||
DROP VIEW IF EXISTS v1;
|
||||
DROP VIEW IF EXISTS v2;
|
||||
DROP VIEW IF EXISTS v3;
|
||||
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
||||
DROP PROCEDURE IF EXISTS p1;
|
||||
DROP PROCEDURE IF EXISTS p2;
|
||||
DROP PROCEDURE IF EXISTS p3;
|
||||
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
DROP FUNCTION IF EXISTS f2;
|
||||
DROP FUNCTION IF EXISTS f3;
|
||||
|
||||
--enable_warnings
|
||||
|
||||
# Test case.
|
||||
|
||||
CREATE TABLE t1(c INT);
|
||||
|
||||
# - try to create with implicit definer (definer would be ''@'');
|
||||
|
||||
CREATE TRIGGER t1_bi BEFORE INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @a = 1;
|
||||
|
||||
CREATE VIEW v1 AS SELECT * FROM t1;
|
||||
|
||||
CREATE PROCEDURE p1()
|
||||
SELECT 1;
|
||||
|
||||
CREATE FUNCTION f1() RETURNS INT
|
||||
RETURN 1;
|
||||
|
||||
# - try to create with explicit definer;
|
||||
|
||||
CREATE DEFINER=a@b TRIGGER ti_ai AFTER INSERT ON t1
|
||||
FOR EACH ROW
|
||||
SET @b = 1;
|
||||
|
||||
CREATE DEFINER=a@b VIEW v2 AS SELECT * FROM t1;
|
||||
|
||||
CREATE DEFINER=a@b PROCEDURE p2()
|
||||
SELECT 2;
|
||||
|
||||
CREATE DEFINER=a@b FUNCTION f2() RETURNS INT
|
||||
RETURN 2;
|
||||
|
||||
# - try to create with explicit definer with empty host;
|
||||
|
||||
CREATE DEFINER=a@'' TRIGGER ti_bu BEFORE UPDATE ON t1
|
||||
FOR EACH ROW
|
||||
SET @c = 1;
|
||||
|
||||
CREATE DEFINER=a@'' VIEW v3 AS SELECT * FROM t1;
|
||||
|
||||
CREATE DEFINER=a@'' PROCEDURE p3()
|
||||
SELECT 3;
|
||||
|
||||
CREATE DEFINER=a@'' FUNCTION f3() RETURNS INT
|
||||
RETURN 3;
|
||||
|
||||
# - check that empty host name is treated correctly;
|
||||
|
||||
SHOW CREATE VIEW v3;
|
||||
|
||||
SHOW CREATE PROCEDURE p3;
|
||||
|
||||
SHOW CREATE FUNCTION f3;
|
||||
|
||||
# Cleanup.
|
||||
|
||||
DROP TRIGGER t1_bi;
|
||||
DROP TRIGGER ti_ai;
|
||||
DROP TRIGGER ti_bu;
|
||||
|
||||
DROP VIEW v1;
|
||||
DROP VIEW v2;
|
||||
DROP VIEW v3;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE p2;
|
||||
DROP PROCEDURE p3;
|
||||
|
||||
DROP FUNCTION f1;
|
||||
DROP FUNCTION f2;
|
||||
DROP FUNCTION f3;
|
||||
|
@ -2602,38 +2602,6 @@ select @i, from_unixtime(@stamped_time, '%d-%m-%Y %h:%i:%s') as time|
|
||||
|
||||
drop procedure bug3426|
|
||||
|
||||
#
|
||||
# BUG#3448
|
||||
#
|
||||
--disable_warnings
|
||||
create table t3 (
|
||||
a int primary key,
|
||||
ach char(1)
|
||||
) engine = innodb|
|
||||
|
||||
create table t4 (
|
||||
b int primary key ,
|
||||
bch char(1)
|
||||
) engine = innodb|
|
||||
--enable_warnings
|
||||
|
||||
insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
|
||||
insert into t4 values (1 , 'bCh1' )|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug3448|
|
||||
--enable_warnings
|
||||
create procedure bug3448()
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
call bug3448()|
|
||||
call bug3448()|
|
||||
|
||||
drop procedure bug3448|
|
||||
drop table t3, t4|
|
||||
|
||||
|
||||
#
|
||||
# BUG#3734
|
||||
#
|
||||
@ -4853,60 +4821,6 @@ DROP TABLE IF EXISTS bug13095_t1;
|
||||
|
||||
delimiter |;
|
||||
|
||||
#
|
||||
# BUG#14210: "Simple query with > operator on large table gives server
|
||||
# crash"
|
||||
# Check that cursors work in case when HEAP tables are converted to
|
||||
# MyISAM
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug14210|
|
||||
--enable_warnings
|
||||
set @@session.max_heap_table_size=16384|
|
||||
select @@session.max_heap_table_size|
|
||||
# To trigger the memory corruption the original table must be InnoDB.
|
||||
# No harm if it's not, so don't warn if the suite is run with --skip-innodb
|
||||
--disable_warnings
|
||||
create table t3 (a char(255)) engine=InnoDB|
|
||||
--enable_warnings
|
||||
create procedure bug14210_fill_table()
|
||||
begin
|
||||
declare table_size, max_table_size int default 0;
|
||||
select @@session.max_heap_table_size into max_table_size;
|
||||
delete from t3;
|
||||
insert into t3 (a) values (repeat('a', 255));
|
||||
repeat
|
||||
insert into t3 select a from t3;
|
||||
select count(*)*255 from t3 into table_size;
|
||||
until table_size > max_table_size*2 end repeat;
|
||||
end|
|
||||
call bug14210_fill_table()|
|
||||
drop procedure bug14210_fill_table|
|
||||
create table t4 like t3|
|
||||
|
||||
create procedure bug14210()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from t3;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
insert into t4 values (upper(a));
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14210()|
|
||||
select count(*) from t4|
|
||||
|
||||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
|
||||
|
||||
#
|
||||
# BUG#1473: Dumping of stored functions seems to cause corruption in
|
||||
# the function body
|
||||
@ -5716,6 +5630,22 @@ call bug16887()|
|
||||
drop table t3|
|
||||
drop procedure bug16887|
|
||||
|
||||
#
|
||||
# Bug#13575 SP funcs in select with distinct/group and order by can
|
||||
# produce bad data
|
||||
#
|
||||
create table t3 (f1 int, f2 varchar(3), primary key(f1)) engine=innodb|
|
||||
insert into t3 values (1,'aaa'),(2,'bbb'),(3,'ccc')|
|
||||
CREATE FUNCTION bug13575 ( p1 integer )
|
||||
returns varchar(3)
|
||||
BEGIN
|
||||
DECLARE v1 VARCHAR(10) DEFAULT null;
|
||||
SELECT f2 INTO v1 FROM t3 WHERE f1 = p1;
|
||||
RETURN v1;
|
||||
END|
|
||||
select distinct f1, bug13575(f1) from t3 order by f1|
|
||||
drop function bug13575;
|
||||
drop table t3|
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
|
@ -419,6 +419,140 @@ drop procedure bug14840_2|
|
||||
drop table t3|
|
||||
|
||||
|
||||
#
|
||||
# BUG#10656: Stored Procedure - Create index and Truncate table command error
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug10656_create_index|
|
||||
drop procedure if exists bug10656_myjoin|
|
||||
drop procedure if exists bug10656_truncate_table|
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t3 (
|
||||
`ID` int(11) default NULL,
|
||||
`txt` char(5) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1|
|
||||
|
||||
INSERT INTO t3 (`ID`,`txt`) VALUES
|
||||
(1,'a'), (2,'b'), (3,'c'), (4,'d')|
|
||||
|
||||
CREATE TABLE t4 (
|
||||
`ID` int(11) default NULL,
|
||||
`txt` char(5) default NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1|
|
||||
|
||||
INSERT INTO t4 (`ID`,`txt`) VALUES
|
||||
(1,'a'), (2,'b'), (3,'c'), (4,'d')|
|
||||
|
||||
create procedure bug10656_create_index()
|
||||
begin
|
||||
create index bug10656_my_index on t3 (ID);
|
||||
end|
|
||||
call bug10656_create_index()|
|
||||
|
||||
create procedure bug10656_myjoin()
|
||||
begin
|
||||
update t3, t4 set t3.txt = t4.txt where t3.id = t4.id;
|
||||
end|
|
||||
call bug10656_myjoin()|
|
||||
|
||||
create procedure bug10656_truncate_table()
|
||||
begin
|
||||
truncate table t3;
|
||||
end|
|
||||
call bug10656_truncate_table()|
|
||||
|
||||
|
||||
drop procedure bug10656_create_index|
|
||||
drop procedure bug10656_myjoin|
|
||||
drop procedure bug10656_truncate_table|
|
||||
drop table t3, t4|
|
||||
|
||||
#
|
||||
# BUG#3448
|
||||
#
|
||||
--disable_warnings
|
||||
create table t3 (
|
||||
a int primary key,
|
||||
ach char(1)
|
||||
) engine = innodb|
|
||||
|
||||
create table t4 (
|
||||
b int primary key,
|
||||
bch char(1)
|
||||
) engine = innodb|
|
||||
--enable_warnings
|
||||
|
||||
insert into t3 values (1 , 'aCh1' ) , ('2' , 'aCh2')|
|
||||
insert into t4 values (1 , 'bCh1' )|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug3448|
|
||||
--enable_warnings
|
||||
create procedure bug3448()
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
|
||||
select * from t3 inner join t4 on t3.a = t4.b|
|
||||
call bug3448()|
|
||||
call bug3448()|
|
||||
|
||||
drop procedure bug3448|
|
||||
drop table t3, t4|
|
||||
|
||||
#
|
||||
# BUG#14210: "Simple query with > operator on large table gives server
|
||||
# crash"
|
||||
# Check that cursors work in case when HEAP tables are converted to
|
||||
# MyISAM
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug14210|
|
||||
--enable_warnings
|
||||
set @@session.max_heap_table_size=16384|
|
||||
select @@session.max_heap_table_size|
|
||||
# To trigger the memory corruption the original table must be InnoDB.
|
||||
# No harm if it's not, so don't warn if the suite is run with --skip-innodb
|
||||
--disable_warnings
|
||||
create table t3 (a char(255)) engine=InnoDB|
|
||||
--enable_warnings
|
||||
create procedure bug14210_fill_table()
|
||||
begin
|
||||
declare table_size, max_table_size int default 0;
|
||||
select @@session.max_heap_table_size into max_table_size;
|
||||
delete from t3;
|
||||
insert into t3 (a) values (repeat('a', 255));
|
||||
repeat
|
||||
insert into t3 select a from t3;
|
||||
select count(*)*255 from t3 into table_size;
|
||||
until table_size > max_table_size*2 end repeat;
|
||||
end|
|
||||
call bug14210_fill_table()|
|
||||
drop procedure bug14210_fill_table|
|
||||
create table t4 like t3|
|
||||
|
||||
create procedure bug14210()
|
||||
begin
|
||||
declare a char(255);
|
||||
declare done int default 0;
|
||||
declare c cursor for select * from t3;
|
||||
declare continue handler for sqlstate '02000' set done = 1;
|
||||
open c;
|
||||
repeat
|
||||
fetch c into a;
|
||||
if not done then
|
||||
insert into t4 values (upper(a));
|
||||
end if;
|
||||
until done end repeat;
|
||||
close c;
|
||||
end|
|
||||
call bug14210()|
|
||||
select count(*) from t4|
|
||||
|
||||
drop table t3, t4|
|
||||
drop procedure bug14210|
|
||||
set @@session.max_heap_table_size=default|
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
@ -2385,3 +2385,17 @@ show create view v1;
|
||||
drop view v1;
|
||||
//
|
||||
delimiter ;//
|
||||
|
||||
#
|
||||
# Bug#17726 Not checked empty list caused endless loop
|
||||
#
|
||||
create table t1(f1 int, f2 int);
|
||||
create view v1 as select ta.f1 as a, tb.f1 as b from t1 ta, t1 tb where ta.f1=tb
|
||||
.f1 and ta.f2=tb.f2;
|
||||
insert into t1 values(1,1),(2,2);
|
||||
create view v2 as select * from v1 where a > 1 with check option;
|
||||
select * from v2;
|
||||
update v2 set b=3 where a=2;
|
||||
select * from v2;
|
||||
drop view v2, v1;
|
||||
drop table t1;
|
||||
|
@ -706,10 +706,9 @@ connection default;
|
||||
#
|
||||
# DEFINER information check
|
||||
#
|
||||
-- error ER_MALFORMED_DEFINER
|
||||
create definer=some_user@`` sql security invoker view v1 as select 1;
|
||||
create definer=some_user@localhost sql security invoker view v1 as select 1;
|
||||
create definer=some_user@localhost sql security invoker view v2 as select 1;
|
||||
show create view v1;
|
||||
show create view v2;
|
||||
drop view v1;
|
||||
|
||||
|
||||
drop view v2;
|
||||
|
Reference in New Issue
Block a user