mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into neptunus.(none):/home/msvensson/mysql/mysql-5.0 mysql-test/mysql-test-run.sh: Auto merged
This commit is contained in:
@ -303,7 +303,7 @@ sub mysqld_arguments ($$$$$);
|
||||
sub stop_masters_slaves ();
|
||||
sub stop_masters ();
|
||||
sub stop_slaves ();
|
||||
sub run_mysqltest ($$);
|
||||
sub run_mysqltest ($);
|
||||
sub usage ($);
|
||||
|
||||
######################################################################
|
||||
@ -1342,10 +1342,11 @@ sub run_testcase ($) {
|
||||
|
||||
if ( ! $glob_use_running_server and ! $glob_use_embedded_server )
|
||||
{
|
||||
if ( $tinfo->{'master_restart'} or $master->[0]->{'uses_special_flags'} )
|
||||
if ( $tinfo->{'master_restart'} or
|
||||
$master->[0]->{'running_master_is_special'} )
|
||||
{
|
||||
stop_masters();
|
||||
$master->[0]->{'uses_special_flags'}= 0; # Forget about why we stopped
|
||||
$master->[0]->{'running_master_is_special'}= 0; # Forget why we stopped
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
@ -1423,9 +1424,9 @@ sub run_testcase ($) {
|
||||
}
|
||||
}
|
||||
|
||||
if ( @{$tinfo->{'master_opt'}} )
|
||||
if ( $tinfo->{'master_restart'} )
|
||||
{
|
||||
$master->[0]->{'uses_special_flags'}= 1;
|
||||
$master->[0]->{'running_master_is_special'}= 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1472,7 +1473,7 @@ sub run_testcase ($) {
|
||||
}
|
||||
unlink($path_timefile);
|
||||
|
||||
my $res= run_mysqltest($tinfo, $tinfo->{'master_opt'});
|
||||
my $res= run_mysqltest($tinfo);
|
||||
|
||||
if ( $res == 0 )
|
||||
{
|
||||
@ -1553,11 +1554,12 @@ sub do_before_start_master ($$) {
|
||||
}
|
||||
}
|
||||
|
||||
# FIXME only remove the ones that are tied to this master
|
||||
# Remove old master.info and relay-log.info files
|
||||
unlink("$opt_vardir/master-data/master.info");
|
||||
unlink("$opt_vardir/master-data/relay-log.info");
|
||||
unlink("$opt_vardir/master1-data/master.info");
|
||||
unlink("$opt_vardir/master1-data/relay-log.info");
|
||||
unlink("$master->[0]->{'path_myddir'}/master.info");
|
||||
unlink("$master->[0]->{'path_myddir'}/relay-log.info");
|
||||
unlink("$master->[1]->{'path_myddir'}/master.info");
|
||||
unlink("$master->[1]->{'path_myddir'}/relay-log.info");
|
||||
|
||||
# Run master initialization shell script if one exists
|
||||
if ( $init_script )
|
||||
@ -1651,12 +1653,15 @@ sub mysqld_arguments ($$$$$) {
|
||||
|
||||
if ( $type eq 'master' )
|
||||
{
|
||||
mtr_add_arg($args, "%s--log-bin=%s/log/master-bin", $prefix, $opt_vardir);
|
||||
my $id= $idx > 0 ? $idx + 101 : 1;
|
||||
|
||||
mtr_add_arg($args, "%s--log-bin=%s/log/master-bin%s", $prefix,
|
||||
$opt_vardir, $sidx);
|
||||
mtr_add_arg($args, "%s--pid-file=%s", $prefix,
|
||||
$master->[$idx]->{'path_mypid'});
|
||||
mtr_add_arg($args, "%s--port=%d", $prefix,
|
||||
$master->[$idx]->{'path_myport'});
|
||||
mtr_add_arg($args, "%s--server-id=1", $prefix);
|
||||
mtr_add_arg($args, "%s--server-id=%d", $prefix, $id);
|
||||
mtr_add_arg($args, "%s--socket=%s", $prefix,
|
||||
$master->[$idx]->{'path_mysock'});
|
||||
mtr_add_arg($args, "%s--innodb_data_file_path=ibdata1:128M:autoextend", $prefix);
|
||||
@ -1664,6 +1669,11 @@ sub mysqld_arguments ($$$$$) {
|
||||
mtr_add_arg($args, "%s--datadir=%s", $prefix,
|
||||
$master->[$idx]->{'path_myddir'});
|
||||
|
||||
if ( $idx > 0 )
|
||||
{
|
||||
mtr_add_arg($args, "%s--skip-innodb", $prefix);
|
||||
}
|
||||
|
||||
if ( $opt_skip_ndbcluster )
|
||||
{
|
||||
mtr_add_arg($args, "%s--skip-ndbcluster", $prefix);
|
||||
@ -1673,7 +1683,7 @@ sub mysqld_arguments ($$$$$) {
|
||||
if ( $type eq 'slave' )
|
||||
{
|
||||
my $slave_server_id= 2 + $idx;
|
||||
my $slave_rpl_rank= $idx > 0 ? 2 : $slave_server_id;
|
||||
my $slave_rpl_rank= $slave_server_id;
|
||||
|
||||
mtr_add_arg($args, "%s--datadir=%s", $prefix,
|
||||
$slave->[$idx]->{'path_myddir'});
|
||||
@ -1973,9 +1983,8 @@ sub stop_slaves () {
|
||||
}
|
||||
|
||||
|
||||
sub run_mysqltest ($$) {
|
||||
sub run_mysqltest ($) {
|
||||
my $tinfo= shift;
|
||||
my $master_opts= shift;
|
||||
|
||||
my $cmdline_mysqldump= "$exe_mysqldump --no-defaults -uroot " .
|
||||
"--socket=$master->[0]->{'path_mysock'} --password=";
|
||||
|
@ -307,7 +307,7 @@ while test $# -gt 0; do
|
||||
--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
|
||||
--ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert.pem \
|
||||
--ssl-key=$MYSQL_TEST_DIR/std_data/server-key.pem"
|
||||
MYSQL_TEST_SSL_OPTS="--ssl-ca=$BASEDIR/SSL/cacert.pem \
|
||||
MYSQL_TEST_SSL_OPTS="--ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem \
|
||||
--ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem \
|
||||
--ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem" ;;
|
||||
--no-manager | --skip-manager) USE_MANAGER=0 ;;
|
||||
|
@ -160,6 +160,21 @@ t1 CREATE TABLE `t1` (
|
||||
`COALESCE('a' COLLATE latin1_bin,'b')` varchar(1) character set latin1 collate latin1_bin NOT NULL default ''
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE t1;
|
||||
SELECT 'case+union+test'
|
||||
UNION
|
||||
SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
|
||||
case+union+test
|
||||
case+union+test
|
||||
nobug
|
||||
SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
|
||||
CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END
|
||||
nobug
|
||||
SELECT 'case+union+test'
|
||||
UNION
|
||||
SELECT CASE '1' WHEN '2' THEN 'BUG' ELSE 'nobug' END;
|
||||
case+union+test
|
||||
case+union+test
|
||||
nobug
|
||||
CREATE TABLE t1 (EMPNUM INT);
|
||||
INSERT INTO t1 VALUES (0), (2);
|
||||
CREATE TABLE t2 (EMPNUM DECIMAL (4, 2));
|
||||
|
@ -800,3 +800,14 @@ field(0,NULL,1,0) field("",NULL,"bar","") field(0.0,NULL,1.0,0.0)
|
||||
select field(NULL,1,2,NULL), field(NULL,1,2,0);
|
||||
field(NULL,1,2,NULL) field(NULL,1,2,0)
|
||||
0 0
|
||||
CREATE TABLE t1 (str varchar(20) PRIMARY KEY);
|
||||
CREATE TABLE t2 (num int primary key);
|
||||
INSERT INTO t1 VALUES ('notnumber');
|
||||
INSERT INTO t2 VALUES (0), (1);
|
||||
SELECT * FROM t1, t2 WHERE num=str;
|
||||
str num
|
||||
notnumber 0
|
||||
SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
|
||||
str num
|
||||
notnumber 0
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -367,13 +367,13 @@ count(*)
|
||||
9
|
||||
explain select count(*) from t1 where v='a ';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 13 const 9 Using where
|
||||
1 SIMPLE t1 ref v v 13 const 10 Using where
|
||||
explain select count(*) from t1 where c='a ';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref c c 11 const 9 Using where
|
||||
1 SIMPLE t1 ref c c 11 const 10 Using where
|
||||
explain select count(*) from t1 where t='a ';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref t t 13 const 9 Using where
|
||||
1 SIMPLE t1 ref t t 13 const 10 Using where
|
||||
explain select count(*) from t1 where v like 'a%';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL v NULL NULL NULL 271 Using where
|
||||
@ -399,7 +399,7 @@ qq
|
||||
*a *a*a *
|
||||
explain select * from t1 where v='a';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref v v 13 const 9 Using where
|
||||
1 SIMPLE t1 ref v v 13 const 10 Using where
|
||||
select v,count(*) from t1 group by v limit 10;
|
||||
v count(*)
|
||||
a 1
|
||||
|
@ -231,18 +231,19 @@ explain select * from t1 where a='aaad';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 8 const 1 Using where
|
||||
insert into t1 select * from t1;
|
||||
flush tables;
|
||||
explain select * from t1 where a='aaaa';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 8 const 1 Using where
|
||||
1 SIMPLE t1 ref a a 8 const 2 Using where
|
||||
explain select * from t1 where a='aaab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 8 const 1 Using where
|
||||
1 SIMPLE t1 ref a a 8 const 2 Using where
|
||||
explain select * from t1 where a='aaac';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 8 const 1 Using where
|
||||
1 SIMPLE t1 ref a a 8 const 2 Using where
|
||||
explain select * from t1 where a='aaad';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 8 const 1 Using where
|
||||
1 SIMPLE t1 ref a a 8 const 2 Using where
|
||||
flush tables;
|
||||
explain select * from t1 where a='aaaa';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@ -261,16 +262,16 @@ delete from t1;
|
||||
insert into t1 select * from t2;
|
||||
explain select * from t1 where a='aaaa';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 8 const 1 Using where
|
||||
1 SIMPLE t1 ref a a 8 const 2 Using where
|
||||
explain select * from t1 where a='aaab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 8 const 1 Using where
|
||||
1 SIMPLE t1 ref a a 8 const 2 Using where
|
||||
explain select * from t1 where a='aaac';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 8 const 1 Using where
|
||||
1 SIMPLE t1 ref a a 8 const 2 Using where
|
||||
explain select * from t1 where a='aaad';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 8 const 1 Using where
|
||||
1 SIMPLE t1 ref a a 8 const 2 Using where
|
||||
drop table t1, t2;
|
||||
create table t1 (
|
||||
id int unsigned not null primary key auto_increment,
|
||||
@ -345,15 +346,15 @@ insert into t3 select name, name from t1;
|
||||
show index from t3;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t3 1 a 1 a NULL NULL NULL NULL HASH
|
||||
t3 1 a 2 b NULL 15 NULL NULL HASH
|
||||
t3 1 a 2 b NULL 13 NULL NULL HASH
|
||||
show index from t3;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t3 1 a 1 a NULL NULL NULL NULL HASH
|
||||
t3 1 a 2 b NULL 15 NULL NULL HASH
|
||||
t3 1 a 2 b NULL 13 NULL NULL HASH
|
||||
explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t3 ref a a 44 const,const 6 Using where
|
||||
1 SIMPLE t1 ref heap_idx heap_idx 22 const 7 Using where
|
||||
1 SIMPLE t3 ref a a 44 const,const 7 Using where
|
||||
drop table t1, t2, t3;
|
||||
create temporary table t1 ( a int, index (a) ) engine=memory;
|
||||
insert into t1 values (1),(2),(3),(4),(5);
|
||||
|
@ -1721,12 +1721,13 @@ count(*)
|
||||
0
|
||||
explain select count(*) from t1 where x > -16;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range PRIMARY PRIMARY 8 NULL 1 Using where; Using index
|
||||
1 SIMPLE t1 index PRIMARY PRIMARY 8 NULL 2 Using where; Using index
|
||||
select count(*) from t1 where x > -16;
|
||||
count(*)
|
||||
1
|
||||
2
|
||||
select * from t1 where x > -16;
|
||||
x
|
||||
18446744073709551600
|
||||
18446744073709551601
|
||||
select count(*) from t1 where x = 18446744073709551601;
|
||||
count(*)
|
||||
|
@ -549,6 +549,66 @@ select count(*) from t2 where x = 18446744073709551601;
|
||||
count(*)
|
||||
0
|
||||
drop table t1,t2;
|
||||
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
||||
insert into t1(x) values (0xfffffffffffffff0);
|
||||
insert into t1(x) values (0xfffffffffffffff1);
|
||||
select * from t1;
|
||||
x
|
||||
18446744073709551600
|
||||
18446744073709551601
|
||||
select count(*) from t1 where x>0;
|
||||
count(*)
|
||||
2
|
||||
select count(*) from t1 where x=0;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1 where x<0;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1 where x < -16;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1 where x = -16;
|
||||
count(*)
|
||||
0
|
||||
select count(*) from t1 where x > -16;
|
||||
count(*)
|
||||
2
|
||||
select count(*) from t1 where x = 18446744073709551601;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (a bigint unsigned);
|
||||
create index t1i on t1(a);
|
||||
insert into t1 select 18446744073709551615;
|
||||
insert into t1 select 18446744073709551614;
|
||||
explain select * from t1 where a <> -1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index
|
||||
select * from t1 where a <> -1;
|
||||
a
|
||||
18446744073709551614
|
||||
18446744073709551615
|
||||
explain select * from t1 where a > -1 or a < -1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index
|
||||
select * from t1 where a > -1 or a < -1;
|
||||
a
|
||||
18446744073709551614
|
||||
18446744073709551615
|
||||
explain select * from t1 where a > -1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index t1i t1i 9 NULL 2 Using where; Using index
|
||||
select * from t1 where a > -1;
|
||||
a
|
||||
18446744073709551614
|
||||
18446744073709551615
|
||||
explain select * from t1 where a < -1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
select * from t1 where a < -1;
|
||||
a
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
create table t1 (a char(10), b text, key (a)) character set latin1;
|
||||
INSERT INTO t1 (a) VALUES
|
||||
|
@ -4,6 +4,8 @@ reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
start slave;
|
||||
|
||||
-------- Test for BUG#9361 --------
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
@ -41,3 +43,82 @@ a b
|
||||
1 6
|
||||
2 6
|
||||
drop table t1,t2;
|
||||
|
||||
-------- Test 1 for BUG#9361 --------
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
CREATE TABLE t1 (
|
||||
a1 char(30),
|
||||
a2 int,
|
||||
a3 int,
|
||||
a4 char(30),
|
||||
a5 char(30)
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
b1 int,
|
||||
b2 char(30)
|
||||
);
|
||||
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
|
||||
INSERT INTO t2 VALUES (1, 'baz');
|
||||
UPDATE t1 a, t2
|
||||
SET a.a1 = 'No'
|
||||
WHERE a.a2 =
|
||||
(SELECT b1
|
||||
FROM t2
|
||||
WHERE b2 = 'baz')
|
||||
AND a.a3 IS NULL
|
||||
AND a.a4 = 'foo'
|
||||
AND a.a5 = 'bar';
|
||||
SELECT * FROM t1;
|
||||
a1 a2 a3 a4 a5
|
||||
No 1 NULL foo bar
|
||||
SELECT * FROM t2;
|
||||
b1 b2
|
||||
1 baz
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
-------- Test 2 for BUG#9361 --------
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
CREATE TABLE t1 (
|
||||
i INT,
|
||||
j INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
CREATE TABLE t2 (
|
||||
i INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
CREATE TABLE t3 (
|
||||
j INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
|
||||
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
|
||||
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
|
||||
UPDATE t1 AS a
|
||||
INNER JOIN t2 AS b
|
||||
ON a.i = b.i
|
||||
INNER JOIN t3 AS c
|
||||
ON a.j = c.j AND b.k = c.k
|
||||
SET a.x = b.x,
|
||||
a.y = b.y,
|
||||
a.z = (
|
||||
SELECT sum(z)
|
||||
FROM t3
|
||||
WHERE y = 34
|
||||
)
|
||||
WHERE b.x = 23;
|
||||
SELECT * FROM t1;
|
||||
i j x y z
|
||||
1 2 23 24 71
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
@ -194,3 +194,20 @@ use test;
|
||||
drop database sptest;
|
||||
delete from mysql.user where user='usera' or user='userb' or user='userc';
|
||||
delete from mysql.procs_priv where user='usera' or user='userb' or user='userc';
|
||||
drop function if exists bug_9503;
|
||||
create database mysqltest//
|
||||
use mysqltest//
|
||||
create table t1 (s1 int)//
|
||||
grant select on t1 to user1@localhost//
|
||||
create function bug_9503 () returns int sql security invoker begin declare v int;
|
||||
select min(s1) into v from t1; return v; end//
|
||||
use mysqltest;
|
||||
select bug_9503();
|
||||
ERROR 42000: execute command denied to user 'user1'@'localhost' for routine 'mysqltest.bug_9503'
|
||||
grant execute on function bug_9503 to user1@localhost;
|
||||
do 1;
|
||||
use test;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
|
||||
drop function bug_9503;
|
||||
use test;
|
||||
drop database mysqltest;
|
||||
|
@ -1025,7 +1025,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
2 UNCACHEABLE SUBQUERY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
Warnings:
|
||||
Note 1003 select sql_no_cache (select sql_no_cache ecrypt(_latin1'test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
Note 1003 select sql_no_cache (select sql_no_cache encrypt(_latin1'test') AS `ENCRYPT('test')` from `test`.`t1`) AS `(SELECT ENCRYPT('test') FROM t1)` from `test`.`t1`
|
||||
EXPLAIN EXTENDED SELECT (SELECT BENCHMARK(1,1) FROM t1) FROM t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 system NULL NULL NULL NULL 0 const row not found
|
||||
@ -2816,3 +2816,24 @@ select * from t1;
|
||||
EMPNUM
|
||||
E1
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1(select_id BIGINT, values_id BIGINT);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
CREATE TABLE t2 (select_id BIGINT, values_id BIGINT,
|
||||
PRIMARY KEY(select_id,values_id));
|
||||
INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5);
|
||||
SELECT values_id FROM t1
|
||||
WHERE values_id IN (SELECT values_id FROM t2
|
||||
WHERE select_id IN (1, 0));
|
||||
values_id
|
||||
1
|
||||
SELECT values_id FROM t1
|
||||
WHERE values_id IN (SELECT values_id FROM t2
|
||||
WHERE select_id BETWEEN 0 AND 1);
|
||||
values_id
|
||||
1
|
||||
SELECT values_id FROM t1
|
||||
WHERE values_id IN (SELECT values_id FROM t2
|
||||
WHERE select_id = 0 OR select_id = 1);
|
||||
values_id
|
||||
1
|
||||
DROP TABLE t1, t2;
|
||||
|
@ -1831,3 +1831,22 @@ select * from v1;
|
||||
t
|
||||
01:00
|
||||
drop view v1;
|
||||
create table t1 (f1 date);
|
||||
insert into t1 values ('2005-01-01'),('2005-02-02');
|
||||
create view v1 as select * from t1;
|
||||
select * from v1 where f1='2005.02.02';
|
||||
f1
|
||||
2005-02-02
|
||||
select * from v1 where '2005.02.02'=f1;
|
||||
f1
|
||||
2005-02-02
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd");
|
||||
SELECT * FROM v1;
|
||||
drop view v1;
|
||||
CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1);
|
||||
SELECT * FROM v1;
|
||||
SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1)
|
||||
dkjhgd
|
||||
drop view v1;
|
||||
|
@ -111,6 +111,17 @@ explain extended SELECT
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
# Test for BUG#10151
|
||||
SELECT 'case+union+test'
|
||||
UNION
|
||||
SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
|
||||
|
||||
SELECT CASE LOWER('1') WHEN LOWER('2') THEN 'BUG' ELSE 'nobug' END;
|
||||
|
||||
SELECT 'case+union+test'
|
||||
UNION
|
||||
SELECT CASE '1' WHEN '2' THEN 'BUG' ELSE 'nobug' END;
|
||||
|
||||
#
|
||||
# Tests for bug #9939: conversion of the arguments for COALESCE and IFNULL
|
||||
#
|
||||
|
@ -529,3 +529,17 @@ DROP TABLE t1, t2;
|
||||
#
|
||||
select field(0,NULL,1,0), field("",NULL,"bar",""), field(0.0,NULL,1.0,0.0);
|
||||
select field(NULL,1,2,NULL), field(NULL,1,2,0);
|
||||
|
||||
#
|
||||
# Bug #10124: access by integer index with a string key that is not a number
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (str varchar(20) PRIMARY KEY);
|
||||
CREATE TABLE t2 (num int primary key);
|
||||
INSERT INTO t1 VALUES ('notnumber');
|
||||
INSERT INTO t2 VALUES (0), (1);
|
||||
|
||||
SELECT * FROM t1, t2 WHERE num=str;
|
||||
SELECT * FROM t1, t2 WHERE num=substring(str from 1 for 6);
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
@ -169,6 +169,8 @@ explain select * from t1 where a='aaac';
|
||||
explain select * from t1 where a='aaad';
|
||||
insert into t1 select * from t1;
|
||||
|
||||
# avoid statistics differences between normal and ps-protocol tests
|
||||
flush tables;
|
||||
explain select * from t1 where a='aaaa';
|
||||
explain select * from t1 where a='aaab';
|
||||
explain select * from t1 where a='aaac';
|
||||
|
@ -418,6 +418,41 @@ select count(*) from t2 where x > -16;
|
||||
select count(*) from t2 where x = 18446744073709551601;
|
||||
drop table t1,t2;
|
||||
|
||||
--disable_warnings
|
||||
create table t1 (x bigint unsigned not null primary key) engine=innodb;
|
||||
--enable_warnings
|
||||
insert into t1(x) values (0xfffffffffffffff0);
|
||||
insert into t1(x) values (0xfffffffffffffff1);
|
||||
select * from t1;
|
||||
select count(*) from t1 where x>0;
|
||||
select count(*) from t1 where x=0;
|
||||
select count(*) from t1 where x<0;
|
||||
select count(*) from t1 where x < -16;
|
||||
select count(*) from t1 where x = -16;
|
||||
select count(*) from t1 where x > -16;
|
||||
select count(*) from t1 where x = 18446744073709551601;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #11185 incorrect comparison of unsigned int to signed constant
|
||||
#
|
||||
create table t1 (a bigint unsigned);
|
||||
create index t1i on t1(a);
|
||||
insert into t1 select 18446744073709551615;
|
||||
insert into t1 select 18446744073709551614;
|
||||
|
||||
explain select * from t1 where a <> -1;
|
||||
select * from t1 where a <> -1;
|
||||
explain select * from t1 where a > -1 or a < -1;
|
||||
select * from t1 where a > -1 or a < -1;
|
||||
explain select * from t1 where a > -1;
|
||||
select * from t1 where a > -1;
|
||||
explain select * from t1 where a < -1;
|
||||
select * from t1 where a < -1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #6045: Binary Comparison regression in MySQL 4.1
|
||||
# Binary searches didn't use a case insensitive index.
|
||||
|
@ -1,7 +1,13 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Let's verify that multi-update with a subselect does not cause the slave to crash
|
||||
# (BUG#10442)
|
||||
|
||||
source include/master-slave.inc;
|
||||
#
|
||||
--disable_query_log
|
||||
SELECT '-------- Test for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
@ -25,10 +31,129 @@ UPDATE t2, (SELECT a FROM t1) AS t SET t2.b = t.a+5 ;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
save_master_pos;
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
sync_with_master;
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
connection master;
|
||||
drop table t1,t2;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Test for BUG#9361:
|
||||
# Subselects should work inside multi-updates
|
||||
#
|
||||
--disable_query_log
|
||||
SELECT '-------- Test 1 for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a1 char(30),
|
||||
a2 int,
|
||||
a3 int,
|
||||
a4 char(30),
|
||||
a5 char(30)
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
b1 int,
|
||||
b2 char(30)
|
||||
);
|
||||
|
||||
# Insert one row per table
|
||||
INSERT INTO t1 VALUES ('Yes', 1, NULL, 'foo', 'bar');
|
||||
INSERT INTO t2 VALUES (1, 'baz');
|
||||
|
||||
# This should update the row in t1
|
||||
UPDATE t1 a, t2
|
||||
SET a.a1 = 'No'
|
||||
WHERE a.a2 =
|
||||
(SELECT b1
|
||||
FROM t2
|
||||
WHERE b2 = 'baz')
|
||||
AND a.a3 IS NULL
|
||||
AND a.a4 = 'foo'
|
||||
AND a.a5 = 'bar';
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
##############################################################################
|
||||
#
|
||||
# Second test for BUG#9361
|
||||
#
|
||||
|
||||
--disable_query_log
|
||||
SELECT '-------- Test 2 for BUG#9361 --------' as "";
|
||||
--enable_query_log
|
||||
|
||||
connection master;
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
DROP TABLE IF EXISTS t2;
|
||||
DROP TABLE IF EXISTS t3;
|
||||
--enable_warnings
|
||||
|
||||
CREATE TABLE t1 (
|
||||
i INT,
|
||||
j INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
CREATE TABLE t2 (
|
||||
i INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
CREATE TABLE t3 (
|
||||
j INT,
|
||||
k INT,
|
||||
x INT,
|
||||
y INT,
|
||||
z INT
|
||||
);
|
||||
|
||||
INSERT INTO t1 VALUES ( 1, 2,13,14,15);
|
||||
INSERT INTO t2 VALUES ( 1, 3,23,24,25);
|
||||
INSERT INTO t3 VALUES ( 2, 3, 1,34,35), ( 2, 3, 1,34,36);
|
||||
|
||||
UPDATE t1 AS a
|
||||
INNER JOIN t2 AS b
|
||||
ON a.i = b.i
|
||||
INNER JOIN t3 AS c
|
||||
ON a.j = c.j AND b.k = c.k
|
||||
SET a.x = b.x,
|
||||
a.y = b.y,
|
||||
a.z = (
|
||||
SELECT sum(z)
|
||||
FROM t3
|
||||
WHERE y = 34
|
||||
)
|
||||
WHERE b.x = 23;
|
||||
|
||||
sync_slave_with_master;
|
||||
connection slave;
|
||||
|
||||
SELECT * FROM t1;
|
||||
|
||||
connection master;
|
||||
DROP TABLE t1, t2, t3;
|
||||
|
@ -304,3 +304,39 @@ drop database sptest;
|
||||
delete from mysql.user where user='usera' or user='userb' or user='userc';
|
||||
delete from mysql.procs_priv where user='usera' or user='userb' or user='userc';
|
||||
|
||||
#
|
||||
# BUG#9503: reseting correct parameters of thread after error in SP function
|
||||
#
|
||||
connect (root,localhost,root,,test);
|
||||
connection root;
|
||||
|
||||
--disable_warnings
|
||||
drop function if exists bug_9503;
|
||||
--enable_warnings
|
||||
delimiter //;
|
||||
create database mysqltest//
|
||||
use mysqltest//
|
||||
create table t1 (s1 int)//
|
||||
grant select on t1 to user1@localhost//
|
||||
create function bug_9503 () returns int sql security invoker begin declare v int;
|
||||
select min(s1) into v from t1; return v; end//
|
||||
delimiter ;//
|
||||
|
||||
connect (user1,localhost,user1,,test);
|
||||
connection user1;
|
||||
use mysqltest;
|
||||
-- error 1370
|
||||
select bug_9503();
|
||||
|
||||
connection root;
|
||||
grant execute on function bug_9503 to user1@localhost;
|
||||
|
||||
connection user1;
|
||||
do 1;
|
||||
use test;
|
||||
|
||||
connection root;
|
||||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM user1@localhost;
|
||||
drop function bug_9503;
|
||||
use test;
|
||||
drop database mysqltest;
|
||||
|
@ -1837,3 +1837,25 @@ WHERE t1.EMPNUM NOT IN
|
||||
WHERE t1.EMPNUM = t2.EMPNUM);
|
||||
select * from t1;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Test for bug #11487: range access in a subquery
|
||||
#
|
||||
|
||||
CREATE TABLE t1(select_id BIGINT, values_id BIGINT);
|
||||
INSERT INTO t1 VALUES (1, 1);
|
||||
CREATE TABLE t2 (select_id BIGINT, values_id BIGINT,
|
||||
PRIMARY KEY(select_id,values_id));
|
||||
INSERT INTO t2 VALUES (0, 1), (0, 2), (0, 3), (1, 5);
|
||||
|
||||
SELECT values_id FROM t1
|
||||
WHERE values_id IN (SELECT values_id FROM t2
|
||||
WHERE select_id IN (1, 0));
|
||||
SELECT values_id FROM t1
|
||||
WHERE values_id IN (SELECT values_id FROM t2
|
||||
WHERE select_id BETWEEN 0 AND 1);
|
||||
SELECT values_id FROM t1
|
||||
WHERE values_id IN (SELECT values_id FROM t2
|
||||
WHERE select_id = 0 OR select_id = 1);
|
||||
|
||||
DROP TABLE t1, t2;
|
||||
|
@ -1673,3 +1673,26 @@ create view v1(k, K) as select 1,2;
|
||||
create view v1 as SELECT TIME_FORMAT(SEC_TO_TIME(3600),'%H:%i') as t;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
|
||||
#
|
||||
# bug #11325 Wrong date comparison in views
|
||||
#
|
||||
create table t1 (f1 date);
|
||||
insert into t1 values ('2005-01-01'),('2005-02-02');
|
||||
create view v1 as select * from t1;
|
||||
select * from v1 where f1='2005.02.02';
|
||||
select * from v1 where '2005.02.02'=f1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# using encrypt & substring_index in view (BUG#7024)
|
||||
#
|
||||
CREATE VIEW v1 AS SELECT ENCRYPT("dhgdhgd");
|
||||
disable_result_log;
|
||||
SELECT * FROM v1;
|
||||
enable_result_log;
|
||||
drop view v1;
|
||||
CREATE VIEW v1 AS SELECT SUBSTRING_INDEX("dkjhgd:kjhdjh", ":", 1);
|
||||
SELECT * FROM v1;
|
||||
drop view v1;
|
||||
|
Reference in New Issue
Block a user