mirror of
https://github.com/MariaDB/server.git
synced 2025-11-09 11:41:36 +03:00
Merge abarkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/bar/mysql-4.1.b20471v2 mysql-test/r/ctype_utf8.result: Auto merged mysql-test/t/ctype_utf8.test: Auto merged
This commit is contained in:
@@ -42,3 +42,11 @@ id str
|
||||
6 aaaaaa
|
||||
7 aaaaaaa
|
||||
drop table t1;
|
||||
set names cp1250;
|
||||
create table t1 (a varchar(15) collate cp1250_czech_cs NOT NULL, primary key(a));
|
||||
insert into t1 values("abcdefgh<67>");
|
||||
insert into t1 values("<22><><EFBFBD><EFBFBD>");
|
||||
select a from t1 where a like "abcdefgh<67>";
|
||||
a
|
||||
abcdefgh<EFBFBD>
|
||||
drop table t1;
|
||||
|
||||
@@ -247,3 +247,14 @@ lpad(c1,3,'
|
||||
select rpad(c1,3,'<27>'), rpad('<27>',3,c1) from t1;
|
||||
rpad(c1,3,'<27>') rpad('<27>',3,c1)
|
||||
<EFBFBD><EFBFBD><EFBFBD> <09><><EFBFBD>
|
||||
drop table t1;
|
||||
set names koi8r;
|
||||
create table t1(a char character set cp1251 default _koi8r 0xFF);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` char(1) character set cp1251 default '<27>'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
create table t1(a char character set latin1 default _cp1251 0xFF);
|
||||
ERROR 42000: Invalid default value for 'a'
|
||||
|
||||
@@ -722,3 +722,42 @@ id MIN(s)
|
||||
1 ZZZ
|
||||
2 ZZZ
|
||||
DROP TABLE t1;
|
||||
drop table if exists bug20536;
|
||||
set names latin1;
|
||||
create table bug20536 (id bigint not null auto_increment primary key, name
|
||||
varchar(255) character set ucs2 not null);
|
||||
insert into `bug20536` (`id`,`name`) values (1, _latin1 x'7465737431'), (2, "'test\\_2'");
|
||||
select md5(name) from bug20536;
|
||||
md5(name)
|
||||
f4b7ce8b45a20e3c4e84bef515d1525c
|
||||
48d95db0d8305c2fe11548a3635c9385
|
||||
select sha1(name) from bug20536;
|
||||
sha1(name)
|
||||
e0b52f38deddb9f9e8d5336b153592794cb49baf
|
||||
677d4d505355eb5b0549b865fcae4b7f0c28aef5
|
||||
select make_set(3, name, upper(name)) from bug20536;
|
||||
make_set(3, name, upper(name))
|
||||
test1,TEST1
|
||||
'test\_2','TEST\_2'
|
||||
select export_set(5, name, upper(name)) from bug20536;
|
||||
export_set(5, name, upper(name))
|
||||
test1,TEST1,test1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1,TEST1
|
||||
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2','TEST\_2'
|
||||
select export_set(5, name, upper(name), ",", 5) from bug20536;
|
||||
export_set(5, name, upper(name), ",", 5)
|
||||
test1,TEST1,test1,TEST1,TEST1
|
||||
'test\_2','TEST\_2','test\_2','TEST\_2','TEST\_2'
|
||||
select password(name) from bug20536;
|
||||
password(name)
|
||||
????????????????????
|
||||
????????????????????
|
||||
select old_password(name) from bug20536;
|
||||
old_password(name)
|
||||
????????
|
||||
????????
|
||||
select quote(name) from bug20536;
|
||||
quote(name)
|
||||
????????
|
||||
????????????????
|
||||
drop table bug20536;
|
||||
End of 4.1 tests
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
show variables like 'collation_server';
|
||||
Variable_name Value
|
||||
collation_server ucs2_unicode_ci
|
||||
show variables like "%character_set_ser%";
|
||||
Variable_name Value
|
||||
character_set_server ucs2
|
||||
|
||||
@@ -924,6 +924,37 @@ NULL
|
||||
select ifnull(NULL, _utf8'string');
|
||||
ifnull(NULL, _utf8'string')
|
||||
string
|
||||
set names utf8;
|
||||
create table t1 (s1 char(5) character set utf8 collate utf8_lithuanian_ci);
|
||||
insert into t1 values ('I'),('K'),('Y');
|
||||
select * from t1 where s1 < 'K' and s1 = 'Y';
|
||||
s1
|
||||
I
|
||||
Y
|
||||
select * from t1 where 'K' > s1 and s1 = 'Y';
|
||||
s1
|
||||
I
|
||||
Y
|
||||
drop table t1;
|
||||
create table t1 (s1 char(5) character set utf8 collate utf8_czech_ci);
|
||||
insert into t1 values ('c'),('d'),('h'),('ch'),('CH'),('cH'),('Ch'),('i');
|
||||
select * from t1 where s1 > 'd' and s1 = 'CH';
|
||||
s1
|
||||
ch
|
||||
CH
|
||||
Ch
|
||||
select * from t1 where 'd' < s1 and s1 = 'CH';
|
||||
s1
|
||||
ch
|
||||
CH
|
||||
Ch
|
||||
select * from t1 where s1 = 'cH' and s1 <> 'ch';
|
||||
s1
|
||||
cH
|
||||
select * from t1 where 'cH' = s1 and s1 <> 'ch';
|
||||
s1
|
||||
cH
|
||||
drop table t1;
|
||||
create table t1 (a varchar(255)) default character set utf8;
|
||||
insert into t1 values (1.0);
|
||||
drop table t1;
|
||||
@@ -1368,3 +1399,31 @@ id tid val
|
||||
42749 72 VOLN<4C> ADSL
|
||||
44205 72 VOLN<4C> ADSL
|
||||
DROP TABLE t1;
|
||||
create table t1(a char(200) collate utf8_unicode_ci NOT NULL default '')
|
||||
default charset=utf8 collate=utf8_unicode_ci;
|
||||
insert into t1 values (unhex('65')), (unhex('C3A9')), (unhex('65'));
|
||||
explain select distinct a from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary
|
||||
select distinct a from t1;
|
||||
a
|
||||
e
|
||||
explain select a from t1 group by a;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using temporary; Using filesort
|
||||
select a from t1 group by a;
|
||||
a
|
||||
e
|
||||
drop table t1;
|
||||
set names utf8;
|
||||
grant select on test.* to юзер_юзер@localhost;
|
||||
user()
|
||||
юзер_юзер@localhost
|
||||
revoke all on test.* from юзер_юзер@localhost;
|
||||
drop user юзер_юзер@localhost;
|
||||
create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
use имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
select database();
|
||||
database()
|
||||
имя_базы_в_кодировке_утф8_длиной_больше_чем_45
|
||||
drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45;
|
||||
|
||||
@@ -555,3 +555,14 @@ EXPLAIN SELECT DISTINCT a,b,d FROM t2 GROUP BY c,b,d;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ALL NULL NULL NULL NULL 3
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (a int primary key, b int);
|
||||
INSERT INTO t1 (a,b) values (1,1), (2,3), (3,2);
|
||||
explain SELECT DISTINCT a, b FROM t1 ORDER BY b;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using filesort
|
||||
SELECT DISTINCT a, b FROM t1 ORDER BY b;
|
||||
a b
|
||||
1 1
|
||||
3 2
|
||||
2 3
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -824,6 +824,7 @@ select 1, min(a) from t1m where 1=99;
|
||||
1 NULL
|
||||
select 1, min(1) from t1m where a=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
select 1, min(1) from t1m where 1=99;
|
||||
1 min(1)
|
||||
1 NULL
|
||||
@@ -835,6 +836,7 @@ select 1, max(a) from t1m where 1=99;
|
||||
1 NULL
|
||||
select 1, max(1) from t1m where a=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
select 1, max(1) from t1m where 1=99;
|
||||
1 max(1)
|
||||
1 NULL
|
||||
|
||||
@@ -93,3 +93,7 @@ SELECT IS_USED_LOCK('bug16501');
|
||||
IS_USED_LOCK('bug16501')
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
select export_set(3, _latin1'foo', _utf8'bar', ',', 4);
|
||||
export_set(3, _latin1'foo', _utf8'bar', ',', 4)
|
||||
foo,foo,bar,bar
|
||||
End of 4.1 tests
|
||||
|
||||
@@ -1036,4 +1036,32 @@ a c
|
||||
abc abc abc
|
||||
xyz xyz xyz
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (s varchar(10));
|
||||
INSERT INTO t1 VALUES ('yadda'), ('yaddy');
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(test.t1.s) > _latin1'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM('y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(both _latin1'y' from test.t1.s) > _latin1'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(LEADING 'y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(leading _latin1'y' from test.t1.s) > _latin1'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(TRAILING 'y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(trailing _latin1'y' from test.t1.s) > _latin1'ab')
|
||||
EXPLAIN EXTENDED SELECT s FROM t1 WHERE TRIM(BOTH 'y' FROM s) > 'ab';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
|
||||
Warnings:
|
||||
Note 1003 select test.t1.s AS `s` from test.t1 where (trim(both _latin1'y' from test.t1.s) > _latin1'ab')
|
||||
DROP TABLE t1;
|
||||
End of 4.1 tests
|
||||
|
||||
@@ -636,6 +636,13 @@ select monthname(str_to_date(null, '%m')), monthname(str_to_date(null, '%m')),
|
||||
monthname(str_to_date(1, '%m')), monthname(str_to_date(0, '%m'));
|
||||
monthname(str_to_date(null, '%m')) monthname(str_to_date(null, '%m')) monthname(str_to_date(1, '%m')) monthname(str_to_date(0, '%m'))
|
||||
NULL NULL January NULL
|
||||
set time_zone='-6:00';
|
||||
create table t1(a timestamp);
|
||||
insert into t1 values (19691231190001);
|
||||
select * from t1;
|
||||
a
|
||||
1969-12-31 19:00:01
|
||||
drop table t1;
|
||||
create table t1(f1 date, f2 time, f3 datetime);
|
||||
insert into t1 values ("2006-01-01", "12:01:01", "2006-01-01 12:01:01");
|
||||
insert into t1 values ("2006-01-02", "12:01:02", "2006-01-02 12:01:02");
|
||||
@@ -688,3 +695,24 @@ t1 CREATE TABLE `t1` (
|
||||
`from_unixtime(1) + 0` double(23,6) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%H') As H);
|
||||
H
|
||||
120
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 DAY)),'%k') As H);
|
||||
H
|
||||
120
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%H') As H);
|
||||
H
|
||||
05
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H)
|
||||
union
|
||||
(select time_format(timediff(now(), DATE_SUB(now(),INTERVAL 5 HOUR)),'%k') As H);
|
||||
H
|
||||
5
|
||||
End of 4.1 tests
|
||||
|
||||
@@ -383,7 +383,7 @@ GRANT SELECT (c) ON `mysqltest_2`.`t1` TO 'mysqltest_3'@'localhost'
|
||||
update mysqltest_1.t1, mysqltest_1.t2 set q=10 where b=1;
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'q' in table 't1'
|
||||
update mysqltest_1.t1, mysqltest_2.t2 set d=20 where d=1;
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for column 'd' in table 't2'
|
||||
ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
||||
update mysqltest_2.t1, mysqltest_1.t2 set c=20 where b=1;
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'c' in table 't1'
|
||||
update mysqltest_2.t1, mysqltest_2.t2 set d=10 where s=2;
|
||||
@@ -402,6 +402,7 @@ revoke all on mysqltest_2.t1 from mysqltest_3@localhost;
|
||||
revoke all on mysqltest_2.t2 from mysqltest_3@localhost;
|
||||
grant all on mysqltest_2.* to mysqltest_3@localhost;
|
||||
grant select on *.* to mysqltest_3@localhost;
|
||||
grant select on mysqltest_2.t1 to mysqltest_3@localhost;
|
||||
flush privileges;
|
||||
use mysqltest_1;
|
||||
update mysqltest_2.t1, mysqltest_2.t2 set c=500,d=600;
|
||||
@@ -409,11 +410,11 @@ update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for column 'a' in table 't1'
|
||||
use mysqltest_2;
|
||||
update mysqltest_1.t1, mysqltest_1.t2 set a=100,b=200;
|
||||
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
||||
update mysqltest_2.t1, mysqltest_1.t2 set c=100,b=200;
|
||||
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't2'
|
||||
update mysqltest_1.t1, mysqltest_2.t2 set a=100,d=200;
|
||||
ERROR 42000: Access denied for user 'mysqltest_3'@'localhost' to database 'mysqltest_1'
|
||||
ERROR 42000: UPDATE command denied to user 'mysqltest_3'@'localhost' for table 't1'
|
||||
select t1.*,t2.* from mysqltest_1.t1,mysqltest_1.t2;
|
||||
a q b r
|
||||
10 2 1 2
|
||||
|
||||
@@ -143,3 +143,13 @@ flush privileges;
|
||||
drop user mysqltest_3@host3;
|
||||
drop user mysqltest_1@host1, mysqltest_2@host2, mysqltest_4@host4,
|
||||
mysqltest_5@host5, mysqltest_6@host6, mysqltest_7@host7;
|
||||
create database mysqltest_1;
|
||||
grant select, insert, update on `mysqltest\_1`.* to mysqltest_1@localhost;
|
||||
set sql_log_off = 1;
|
||||
ERROR HY000: Access denied; you need the SUPER privilege for this operation
|
||||
set sql_log_bin = 0;
|
||||
ERROR HY000: Access denied; you need the SUPER privilege for this operation
|
||||
delete from mysql.user where user like 'mysqltest\_1';
|
||||
delete from mysql.db where user like 'mysqltest\_1';
|
||||
drop database mysqltest_1;
|
||||
flush privileges;
|
||||
|
||||
@@ -246,3 +246,38 @@ DELETE from t1 where a < 100;
|
||||
SELECT * from t1;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
create table t1(a int not null, key using btree(a)) engine=heap;
|
||||
insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
|
||||
select a from t1 where a > 2;
|
||||
a
|
||||
3
|
||||
3
|
||||
3
|
||||
3
|
||||
delete from t1 where a < 4;
|
||||
select a from t1 order by a;
|
||||
a
|
||||
insert into t1 values (2), (2), (2), (1), (1), (3), (3), (3), (3);
|
||||
select a from t1 where a > 4;
|
||||
a
|
||||
delete from t1 where a > 4;
|
||||
select a from t1 order by a;
|
||||
a
|
||||
1
|
||||
1
|
||||
2
|
||||
2
|
||||
2
|
||||
3
|
||||
3
|
||||
3
|
||||
3
|
||||
select a from t1 where a > 3;
|
||||
a
|
||||
delete from t1 where a >= 2;
|
||||
select a from t1 order by a;
|
||||
a
|
||||
1
|
||||
1
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
|
||||
@@ -83,3 +83,24 @@ b a
|
||||
3 3
|
||||
3 3
|
||||
DROP TABLE t1, t2, t3;
|
||||
CREATE TABLE `t1` (`id1` INT) ;
|
||||
INSERT INTO `t1` (`id1`) VALUES (1),(5),(2);
|
||||
CREATE TABLE `t2` (
|
||||
`id1` INT,
|
||||
`id2` INT NOT NULL,
|
||||
`id3` INT,
|
||||
`id4` INT NOT NULL,
|
||||
UNIQUE (`id2`,`id4`),
|
||||
KEY (`id1`)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO `t2`(`id1`,`id2`,`id3`,`id4`) VALUES
|
||||
(1,1,1,0),
|
||||
(1,1,2,1),
|
||||
(5,1,2,2),
|
||||
(6,1,2,3),
|
||||
(1,2,2,2),
|
||||
(1,2,1,1);
|
||||
SELECT `id1` FROM `t1` WHERE `id1` NOT IN (SELECT `id1` FROM `t2` WHERE `id2` = 1 AND `id3` = 2);
|
||||
id1
|
||||
2
|
||||
DROP TABLE t1, t2;
|
||||
|
||||
@@ -76,3 +76,17 @@ a
|
||||
a
|
||||
1
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2),(3),(4),(5),(6),(7);
|
||||
explain select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
|
||||
select count(*) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
c
|
||||
7
|
||||
explain select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where; Using temporary
|
||||
select sum(a) c FROM t1 WHERE a > 0 ORDER BY c LIMIT 3;
|
||||
c
|
||||
28
|
||||
|
||||
@@ -773,12 +773,12 @@ show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TEMPORARY TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TEMPORARY TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQL_TEST_DIR/var/log/'
|
||||
create table t1 (a int) engine=myisam select 42 a;
|
||||
select * from t1;
|
||||
a
|
||||
|
||||
@@ -1557,4 +1557,31 @@ CREATE TABLE `t2` (
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t1, t2, t3;
|
||||
create table t1 (a int);
|
||||
mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `t1` WHERE xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 (1064)
|
||||
mysqldump: Got error: 1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' at line 1 when retrieving data from server
|
||||
|
||||
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
|
||||
/*!40101 SET NAMES utf8 */;
|
||||
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
|
||||
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
|
||||
DROP TABLE IF EXISTS `t1`;
|
||||
CREATE TABLE `t1` (
|
||||
`a` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
|
||||
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
|
||||
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
|
||||
|
||||
drop table t1;
|
||||
End of 4.1 tests
|
||||
|
||||
@@ -64,17 +64,26 @@ pk u o
|
||||
insert into t1 values (1,1,1);
|
||||
drop table t1;
|
||||
create table t1 (x integer not null primary key, y varchar(32), z integer, key(z)) engine = ndb;
|
||||
insert into t1 values (1,'one',1), (2,'two',2),(3,"three",3);
|
||||
insert into t1 values (1,'one',1);
|
||||
begin;
|
||||
select * from t1 where x = 1 for update;
|
||||
x y z
|
||||
1 one 1
|
||||
begin;
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
rollback;
|
||||
insert into t1 values (2,'two',2),(3,"three",3);
|
||||
begin;
|
||||
select * from t1 where x = 1 for update;
|
||||
x y z
|
||||
1 one 1
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
select * from t1 where x = 2 for update;
|
||||
x y z
|
||||
2 two 2
|
||||
select * from t1 where x = 1 for update;
|
||||
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
|
||||
rollback;
|
||||
commit;
|
||||
begin;
|
||||
|
||||
@@ -282,7 +282,7 @@ t9 MyISAM 9 Dynamic 2 220 440 4294967295 2048 0 NULL # # # latin1_swedish_ci NUL
|
||||
prepare stmt4 from ' show status like ''Threads_running'' ';
|
||||
execute stmt4;
|
||||
Variable_name Value
|
||||
Threads_running 1
|
||||
Threads_running #
|
||||
prepare stmt4 from ' show variables like ''sql_mode'' ';
|
||||
execute stmt4;
|
||||
Variable_name Value
|
||||
|
||||
@@ -37,3 +37,14 @@ Table Op Msg_type Msg_text
|
||||
test.t1 repair warning Number of rows changed from 0 to 1
|
||||
test.t1 repair status OK
|
||||
drop table t1;
|
||||
CREATE TABLE t1(a INT, KEY(a));
|
||||
INSERT INTO t1 VALUES(1),(2),(3),(4),(5);
|
||||
SET myisam_repair_threads=2;
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
SHOW INDEX FROM t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 1 a 1 a A 5 NULL NULL YES BTREE
|
||||
SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
DROP TABLE t1;
|
||||
|
||||
@@ -2744,3 +2744,78 @@ SELECT i='1e+01',i=1e+01, i in (1e+01), i in ('1e+01') FROM t1;
|
||||
i='1e+01' i=1e+01 i in (1e+01) i in ('1e+01')
|
||||
0 1 1 1
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int, b int);
|
||||
INSERT INTO t1 VALUES (1,1), (2,1), (4,10);
|
||||
CREATE TABLE t2 (a int PRIMARY KEY, b int, KEY b (b));
|
||||
INSERT INTO t2 VALUES (1,NULL), (2,10);
|
||||
ALTER TABLE t1 ENABLE KEYS;
|
||||
EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index b b 5 NULL 2 Using index
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
a b a b
|
||||
1 NULL 1 1
|
||||
1 NULL 2 1
|
||||
1 NULL 4 10
|
||||
2 10 4 10
|
||||
EXPLAIN SELECT STRAIGHT_JOIN SQL_NO_CACHE COUNT(*) FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 index b b 5 NULL 2 Using index
|
||||
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 Using where
|
||||
SELECT STRAIGHT_JOIN SQL_NO_CACHE * FROM t2, t1 WHERE t1.b = t2.b OR t2.b IS NULL;
|
||||
a b a b
|
||||
1 NULL 1 1
|
||||
1 NULL 2 1
|
||||
1 NULL 4 10
|
||||
2 10 4 10
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
CREATE TABLE t1 (key1 float default NULL, UNIQUE KEY key1 (key1));
|
||||
CREATE TABLE t2 (key2 float default NULL, UNIQUE KEY key2 (key2));
|
||||
INSERT INTO t1 VALUES (0.3762),(0.3845),(0.6158),(0.7941);
|
||||
INSERT INTO t2 VALUES (1.3762),(1.3845),(1.6158),(1.7941);
|
||||
explain select max(key1) from t1 where key1 <= 0.6158;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select max(key2) from t2 where key2 <= 1.6158;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select min(key1) from t1 where key1 >= 0.3762;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select min(key2) from t2 where key2 >= 1.3762;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select max(key1), min(key2) from t1, t2
|
||||
where key1 <= 0.6158 and key2 >= 1.3762;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
explain select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
select max(key1) from t1 where key1 <= 0.6158;
|
||||
max(key1)
|
||||
0.61580002307892
|
||||
select max(key2) from t2 where key2 <= 1.6158;
|
||||
max(key2)
|
||||
1.6158000230789
|
||||
select min(key1) from t1 where key1 >= 0.3762;
|
||||
min(key1)
|
||||
0.37619999051094
|
||||
select min(key2) from t2 where key2 >= 1.3762;
|
||||
min(key2)
|
||||
1.3761999607086
|
||||
select max(key1), min(key2) from t1, t2
|
||||
where key1 <= 0.6158 and key2 >= 1.3762;
|
||||
max(key1) min(key2)
|
||||
0.61580002307892 1.3761999607086
|
||||
select max(key1) from t1 where key1 <= 0.6158 and rand() + 0.5 >= 0.5;
|
||||
max(key1)
|
||||
0.61580002307892
|
||||
select min(key1) from t1 where key1 >= 0.3762 and rand() + 0.5 >= 0.5;
|
||||
min(key1)
|
||||
0.37619999051094
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
@@ -539,7 +539,7 @@ EXPLAIN EXTENDED SELECT MAX(numreponse) FROM t1 WHERE numeropost='1';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away
|
||||
Warnings:
|
||||
Note 1003 select max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1 where (test.t1.numeropost = _latin1'1')
|
||||
Note 1003 select max(test.t1.numreponse) AS `MAX(numreponse)` from test.t1
|
||||
EXPLAIN EXTENDED SELECT numreponse FROM t1 WHERE numeropost='1' AND numreponse=(SELECT MAX(numreponse) FROM t1 WHERE numeropost='1');
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 const PRIMARY,numreponse PRIMARY 7 const,const 1 Using index
|
||||
@@ -2868,3 +2868,52 @@ select 1 from dual where 1 < any (select 2 from dual);
|
||||
select 1 from dual where 1 < all (select 2 from dual where 1!=1);
|
||||
1
|
||||
1
|
||||
create table t1 (s1 char);
|
||||
insert into t1 values (1),(2);
|
||||
select * from t1 where (s1 < any (select s1 from t1));
|
||||
s1
|
||||
1
|
||||
select * from t1 where not (s1 < any (select s1 from t1));
|
||||
s1
|
||||
2
|
||||
select * from t1 where (s1 < ALL (select s1+1 from t1));
|
||||
s1
|
||||
1
|
||||
select * from t1 where not(s1 < ALL (select s1+1 from t1));
|
||||
s1
|
||||
2
|
||||
select * from t1 where (s1+1 = ANY (select s1 from t1));
|
||||
s1
|
||||
1
|
||||
select * from t1 where NOT(s1+1 = ANY (select s1 from t1));
|
||||
s1
|
||||
2
|
||||
select * from t1 where (s1 = ALL (select s1/s1 from t1));
|
||||
s1
|
||||
1
|
||||
select * from t1 where NOT(s1 = ALL (select s1/s1 from t1));
|
||||
s1
|
||||
2
|
||||
drop table t1;
|
||||
create table t1 (
|
||||
retailerID varchar(8) NOT NULL,
|
||||
statusID int(10) unsigned NOT NULL,
|
||||
changed datetime NOT NULL,
|
||||
UNIQUE KEY retailerID (retailerID, statusID, changed)
|
||||
);
|
||||
INSERT INTO t1 VALUES("0026", "1", "2005-12-06 12:18:56");
|
||||
INSERT INTO t1 VALUES("0026", "2", "2006-01-06 12:25:53");
|
||||
INSERT INTO t1 VALUES("0037", "1", "2005-12-06 12:18:56");
|
||||
INSERT INTO t1 VALUES("0037", "2", "2006-01-06 12:25:53");
|
||||
INSERT INTO t1 VALUES("0048", "1", "2006-01-06 12:37:50");
|
||||
INSERT INTO t1 VALUES("0059", "1", "2006-01-06 12:37:50");
|
||||
select * from t1 r1
|
||||
where (r1.retailerID,(r1.changed)) in
|
||||
(SELECT r2.retailerId,(max(changed)) from t1 r2
|
||||
group by r2.retailerId);
|
||||
retailerID statusID changed
|
||||
0026 2 2006-01-06 12:25:53
|
||||
0037 2 2006-01-06 12:25:53
|
||||
0048 1 2006-01-06 12:37:50
|
||||
0059 1 2006-01-06 12:37:50
|
||||
drop table t1;
|
||||
|
||||
@@ -130,3 +130,15 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
5 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX PRIMARY 32 func 1 Using index; Using where
|
||||
6 DEPENDENT SUBQUERY t3 unique_subquery PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 32 func 1 Using index; Using where
|
||||
drop table t1, t2, t3, t4;
|
||||
CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
CREATE TABLE t2 (a int(10), PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t2 VALUES (1);
|
||||
CREATE TABLE t3 (a int(10), b int(10), c int(10),
|
||||
PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t3 VALUES (1,2,1);
|
||||
SELECT t1.* FROM t1 WHERE (SELECT COUNT(*) FROM t3,t2 WHERE t3.c=t2.a
|
||||
and t2.a='1' AND t1.a=t3.b) > 0;
|
||||
a
|
||||
2
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
Reference in New Issue
Block a user