mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge mysql.com:/home/jonas/src/mysql-5.0
into mysql.com:/home/jonas/src/mysql-5.0-ndb
This commit is contained in:
@ -2,7 +2,7 @@ drop table if exists t1;
|
||||
set sql_mode="MySQL40";
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
NO_FIELD_OPTIONS,MYSQL40
|
||||
NO_FIELD_OPTIONS,MYSQL40,BROKEN_NOT
|
||||
set @@sql_mode="ANSI";
|
||||
select @@sql_mode;
|
||||
@@sql_mode
|
||||
|
@ -134,3 +134,10 @@ select * from t1 where firstname='john' and firstname like binary 'John';
|
||||
firstname lastname
|
||||
John Doe
|
||||
drop table t1;
|
||||
create table t1 (a binary);
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`a` binary(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
|
@ -33,6 +33,24 @@ a
|
||||
SELECT * FROM t1 where (1 AND a) IS NULL;
|
||||
a
|
||||
NULL
|
||||
set sql_mode='broken_not';
|
||||
select * from t1 where not a between 2 and 3;
|
||||
a
|
||||
set sql_mode=default;
|
||||
select * from t1 where not a between 2 and 3;
|
||||
a
|
||||
0
|
||||
1
|
||||
select a, a is false, a is true, a is unknown from t1;
|
||||
a a is false a is true a is unknown
|
||||
0 1 0 0
|
||||
1 0 1 0
|
||||
NULL 0 0 1
|
||||
select a, a is not false, a is not true, a is not unknown from t1;
|
||||
a a is not false a is not true a is not unknown
|
||||
0 0 1 1
|
||||
1 1 0 1
|
||||
NULL 1 1 0
|
||||
SET @a=0, @b=0;
|
||||
SELECT * FROM t1 WHERE NULL AND (@a:=@a+1);
|
||||
a
|
||||
|
@ -487,3 +487,20 @@ prepare stmt1 from @str2;
|
||||
execute stmt1 using @ivar;
|
||||
?
|
||||
1234
|
||||
SET TIMESTAMP=10000;
|
||||
create table t2 (c char(30)) charset=ucs2;
|
||||
set @v=convert('abc' using ucs2);
|
||||
reset master;
|
||||
insert into t2 values (@v);
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 User var 1 135 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
|
||||
master-bin.000001 135 Query 1 218 use `test`; insert into t2 values (@v)
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
|
||||
use test;
|
||||
SET TIMESTAMP=10000;
|
||||
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=1, @@session.unique_checks=1;
|
||||
SET @@session.sql_mode=0;
|
||||
insert into t2 values (@v);
|
||||
drop table t2;
|
||||
|
@ -382,3 +382,12 @@ s
|
||||
p<EFBFBD>ra para para
|
||||
para para para
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (h text, FULLTEXT (h));
|
||||
INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
|
||||
REPAIR TABLE t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 repair status OK
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
||||
|
@ -4,7 +4,7 @@ insert into t1 values(1,1),(2,2),(3,3),(4,4);
|
||||
delete from t1 where a=1 or a=0;
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 0 PRIMARY 1 a NULL NULL NULL NULL HASH
|
||||
t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
|
||||
select * from t1;
|
||||
a b
|
||||
2 2
|
||||
@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
|
||||
explain select * from t1 where btn="a" and new_col="a";
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref btn btn 11 const,const 10 Using where
|
||||
1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a int default NULL,
|
||||
@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
|
||||
a b
|
||||
explain SELECT * FROM t1 WHERE a IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 5 const 10 Using where
|
||||
1 SIMPLE t1 ref a a 5 const 1 Using where
|
||||
SELECT * FROM t1 WHERE a<=>NULL;
|
||||
a b
|
||||
NULL 99
|
||||
@ -204,7 +204,7 @@ key a (a)
|
||||
INSERT INTO t1 VALUES (10), (10), (10);
|
||||
EXPLAIN SELECT * FROM t1 WHERE a=10;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 5 const 10 Using where
|
||||
1 SIMPLE t1 ref a a 5 const 3 Using where
|
||||
SELECT * FROM t1 WHERE a=10;
|
||||
a
|
||||
10
|
||||
|
@ -1,10 +1,10 @@
|
||||
drop table if exists t1;
|
||||
drop table if exists t1,t2;
|
||||
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
|
||||
insert into t1 values(1,1),(2,2),(3,3),(4,4);
|
||||
delete from t1 where a=1 or a=0;
|
||||
show keys from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 0 PRIMARY 1 a NULL NULL NULL NULL HASH
|
||||
t1 0 PRIMARY 1 a NULL 3 NULL NULL HASH
|
||||
select * from t1;
|
||||
a b
|
||||
2 2
|
||||
@ -169,7 +169,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ALL btn NULL NULL NULL 11 Using where
|
||||
explain select * from t1 where btn="a" and new_col="a";
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref btn btn 11 const,const 10 Using where
|
||||
1 SIMPLE t1 ref btn btn 11 const,const 2 Using where
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
a int default NULL,
|
||||
@ -182,7 +182,7 @@ SELECT * FROM t1 WHERE a=NULL;
|
||||
a b
|
||||
explain SELECT * FROM t1 WHERE a IS NULL;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref a a 5 const 10 Using where
|
||||
1 SIMPLE t1 ref a a 5 const 1 Using where
|
||||
SELECT * FROM t1 WHERE a<=>NULL;
|
||||
a b
|
||||
NULL 99
|
||||
@ -203,3 +203,155 @@ DELETE from t1 where a < 100;
|
||||
SELECT * from t1;
|
||||
a
|
||||
DROP TABLE t1;
|
||||
create table t1
|
||||
(
|
||||
a char(8) not null,
|
||||
b char(20) not null,
|
||||
c int not null,
|
||||
key (a)
|
||||
) engine=heap;
|
||||
insert into t1 values ('aaaa', 'prefill-hash=5',0);
|
||||
insert into t1 values ('aaab', 'prefill-hash=0',0);
|
||||
insert into t1 values ('aaac', 'prefill-hash=7',0);
|
||||
insert into t1 values ('aaad', 'prefill-hash=2',0);
|
||||
insert into t1 values ('aaae', 'prefill-hash=1',0);
|
||||
insert into t1 values ('aaaf', 'prefill-hash=4',0);
|
||||
insert into t1 values ('aaag', 'prefill-hash=3',0);
|
||||
insert into t1 values ('aaah', 'prefill-hash=6',0);
|
||||
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
|
||||
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
|
||||
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
|
||||
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;
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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 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 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 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 2 Using where
|
||||
create table t2 as select * from t1;
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
drop table t1, t2;
|
||||
create table t1 (
|
||||
id int unsigned not null primary key auto_increment,
|
||||
name varchar(20) not null,
|
||||
index heap_idx(name),
|
||||
index btree_idx using btree(name)
|
||||
) engine=heap;
|
||||
create table t2 (
|
||||
id int unsigned not null primary key auto_increment,
|
||||
name varchar(20) not null,
|
||||
index btree_idx using btree(name),
|
||||
index heap_idx(name)
|
||||
) engine=heap;
|
||||
insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'),
|
||||
('Suzy'), ('Hoppy'), ('Burrito'), ('Mimi'), ('Sherry'), ('Ben'), ('Phil'),
|
||||
('Emily'), ('Mike');
|
||||
insert into t2 select * from t1;
|
||||
explain select * from t1 where name='matt';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
|
||||
explain select * from t2 where name='matt';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
|
||||
explain select * from t1 where name='Lilu';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
|
||||
explain select * from t2 where name='Lilu';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
|
||||
explain select * from t1 where name='Phil';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
|
||||
explain select * from t2 where name='Phil';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
|
||||
explain select * from t1 where name='Lilu';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref heap_idx,btree_idx heap_idx 20 const 1 Using where
|
||||
explain select * from t2 where name='Lilu';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t2 ref btree_idx,heap_idx btree_idx 20 const 1 Using where
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
flush tables;
|
||||
select count(*) from t1 where name='Matt';
|
||||
count(*)
|
||||
7
|
||||
explain select * from t1 ignore index (btree_idx) where name='matt';
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH
|
||||
t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
|
||||
t1 1 btree_idx 1 name A NULL NULL NULL BTREE
|
||||
show index from t1;
|
||||
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
|
||||
t1 0 PRIMARY 1 id NULL 91 NULL NULL HASH
|
||||
t1 1 heap_idx 1 name NULL 13 NULL NULL HASH
|
||||
t1 1 btree_idx 1 name A NULL NULL NULL BTREE
|
||||
create table t3
|
||||
(
|
||||
a varchar(20) not null,
|
||||
b varchar(20) not null,
|
||||
key (a,b)
|
||||
) engine=heap;
|
||||
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
|
||||
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
|
||||
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 40 const,const 6 Using where
|
||||
1 SIMPLE t1 ref heap_idx heap_idx 20 const 7 Using where
|
||||
drop table t1, t2, t3;
|
||||
|
@ -116,7 +116,7 @@ Field Type Collation Null Key Default Extra Privileges Comment
|
||||
Insert_priv enum('N','Y') utf8_bin N select,insert,update,references
|
||||
show full columns from v1;
|
||||
Field Type Collation Null Key Default Extra Privileges Comment
|
||||
c char(64) latin1_swedish_ci select,insert,update,references
|
||||
c char(64) utf8_general_ci select,insert,update,references
|
||||
select * from information_schema.COLUMNS where table_name="t1"
|
||||
and column_name= "a";
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME COLUMN_NAME ORDINAL_POSITION DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME TYPE COLLATION_NAME IS_NULLABLE KEY COLUMN_DEFAULT EXTRA PRIVILEGES COMMENT
|
||||
@ -245,7 +245,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE # ALL NULL NULL NULL NULL 2
|
||||
1 SIMPLE # ALL NULL NULL NULL NULL 2 Using where
|
||||
select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
|
||||
mysql.proc b where a.ROUTINE_NAME = b.name;
|
||||
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8);
|
||||
ROUTINE_NAME name
|
||||
sub1 sub1
|
||||
sel2 sel2
|
||||
@ -292,10 +292,10 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par
|
||||
select * from information_schema.VIEWS where TABLE_NAME like "v%";
|
||||
TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE
|
||||
NULL test v0 select `SCHEMATA`.`SCHEMA_NAME` AS `c` from `information_schema`.`SCHEMATA` NONE NO
|
||||
NULL test v1 select `TABLES`.`TABLE_NAME` AS `c` from `information_schema`.`TABLES` where (`TABLES`.`TABLE_NAME` = _latin1'v1') NONE NO
|
||||
NULL test v2 select `COLUMNS`.`COLUMN_NAME` AS `c` from `information_schema`.`COLUMNS` where (`COLUMNS`.`TABLE_NAME` = _latin1'v2') NONE NO
|
||||
NULL test v3 select `CHARACTER_SETS`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`CHARACTER_SETS` where (`CHARACTER_SETS`.`CHARACTER_SET_NAME` like _latin1'latin1%') NONE NO
|
||||
NULL test v4 select `COLLATIONS`.`COLLATION_NAME` AS `c` from `information_schema`.`COLLATIONS` where (`COLLATIONS`.`COLLATION_NAME` like _latin1'latin1%') NONE NO
|
||||
NULL test v1 select `TABLES`.`TABLE_NAME` AS `c` from `information_schema`.`TABLES` where (`TABLES`.`TABLE_NAME` = _utf8'v1') NONE NO
|
||||
NULL test v2 select `COLUMNS`.`COLUMN_NAME` AS `c` from `information_schema`.`COLUMNS` where (`COLUMNS`.`TABLE_NAME` = _utf8'v2') NONE NO
|
||||
NULL test v3 select `CHARACTER_SETS`.`CHARACTER_SET_NAME` AS `c` from `information_schema`.`CHARACTER_SETS` where (`CHARACTER_SETS`.`CHARACTER_SET_NAME` like _utf8'latin1%') NONE NO
|
||||
NULL test v4 select `COLLATIONS`.`COLLATION_NAME` AS `c` from `information_schema`.`COLLATIONS` where (`COLLATIONS`.`COLLATION_NAME` like _utf8'latin1%') NONE NO
|
||||
drop view v0, v1, v2, v3, v4;
|
||||
create table t1 (a int);
|
||||
grant select,update,insert on t1 to mysqltest_1@localhost;
|
||||
@ -445,3 +445,44 @@ select AUTO_INCREMENT from information_schema.tables where table_name = 't1';
|
||||
AUTO_INCREMENT
|
||||
4
|
||||
drop table t1;
|
||||
create table t1 (s1 int);
|
||||
insert into t1 values (0),(9),(0);
|
||||
select s1 from t1 where s1 in (select version from
|
||||
information_schema.tables) union select version from
|
||||
information_schema.tables;
|
||||
s1
|
||||
9
|
||||
drop table t1;
|
||||
SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS;
|
||||
Table Create Table
|
||||
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
|
||||
`CHARACTER_SET_NAME` char(30) NOT NULL default '',
|
||||
`Description` char(60) NOT NULL default '',
|
||||
`DEFAULT_COLLATE_NAME` char(60) NOT NULL default '',
|
||||
`Maxlen` bigint(3) NOT NULL default '0'
|
||||
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2282
|
||||
set names latin2;
|
||||
SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS;
|
||||
Table Create Table
|
||||
CHARACTER_SETS CREATE TEMPORARY TABLE `CHARACTER_SETS` (
|
||||
`CHARACTER_SET_NAME` char(30) NOT NULL default '',
|
||||
`Description` char(60) NOT NULL default '',
|
||||
`DEFAULT_COLLATE_NAME` char(60) NOT NULL default '',
|
||||
`Maxlen` bigint(3) NOT NULL default '0'
|
||||
) ENGINE=HEAP DEFAULT CHARSET=utf8 MAX_ROWS=2282
|
||||
set names latin1;
|
||||
create table t1 select * from information_schema.CHARACTER_SETS
|
||||
where CHARACTER_SET_NAME like "latin1";
|
||||
select * from t1;
|
||||
CHARACTER_SET_NAME Description DEFAULT_COLLATE_NAME Maxlen
|
||||
latin1 ISO 8859-1 West European latin1_swedish_ci 1
|
||||
alter table t1 default character set utf8;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`CHARACTER_SET_NAME` char(30) NOT NULL default '',
|
||||
`Description` char(60) NOT NULL default '',
|
||||
`DEFAULT_COLLATE_NAME` char(60) NOT NULL default '',
|
||||
`Maxlen` bigint(3) NOT NULL default '0'
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8
|
||||
drop table t1;
|
||||
|
@ -1664,3 +1664,21 @@ select count(*) from t1 where x = 18446744073709551601;
|
||||
count(*)
|
||||
1
|
||||
drop table t1;
|
||||
show status like "Innodb_buffer_pool_pages_total";
|
||||
Variable_name Value
|
||||
Innodb_buffer_pool_pages_total 512
|
||||
show status like "Innodb_page_size";
|
||||
Variable_name Value
|
||||
Innodb_page_size 16384
|
||||
show status like "Innodb_rows_deleted";
|
||||
Variable_name Value
|
||||
Innodb_rows_deleted 2078
|
||||
show status like "Innodb_rows_inserted";
|
||||
Variable_name Value
|
||||
Innodb_rows_inserted 31706
|
||||
show status like "Innodb_rows_read";
|
||||
Variable_name Value
|
||||
Innodb_rows_read 80161
|
||||
show status like "Innodb_rows_updated";
|
||||
Variable_name Value
|
||||
Innodb_rows_updated 29530
|
||||
|
@ -277,3 +277,13 @@ Key_blocks_unused KEY_BLOCKS_UNUSED
|
||||
set global keycache2.key_buffer_size=0;
|
||||
set global keycache3.key_buffer_size=100;
|
||||
set global keycache3.key_buffer_size=0;
|
||||
create table t1 (mytext text, FULLTEXT (mytext));
|
||||
insert t1 values ('aaabbb');
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
set GLOBAL key_cache_block_size=2048;
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
|
@ -543,7 +543,7 @@ Warnings:
|
||||
Note 1031 Table storage engine for 't1' doesn't have this option
|
||||
show keys 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 NULL NULL NULL NULL YES HASH
|
||||
t1 1 a 1 a NULL 1000 NULL NULL YES HASH
|
||||
drop table t1,t2;
|
||||
create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
|
||||
insert into t1 values (null,''), (null,'');
|
||||
|
@ -2058,6 +2058,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
|
||||
drop table t4, t3, t2, t1;
|
||||
DO 1;
|
||||
DO benchmark(100,1+1),1,1;
|
||||
do default;
|
||||
ERROR 42000: 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 '' at line 1
|
||||
do foobar;
|
||||
ERROR 42S22: Unknown column 'foobar' in 'field list'
|
||||
CREATE TABLE t1 (
|
||||
id mediumint(8) unsigned NOT NULL auto_increment,
|
||||
pseudo varchar(35) NOT NULL default '',
|
||||
|
@ -61,7 +61,7 @@ t1 CREATE TABLE `t1` (
|
||||
set @@sql_mode="no_field_options,mysql323,mysql40";
|
||||
show variables like 'sql_mode';
|
||||
Variable_name Value
|
||||
sql_mode NO_FIELD_OPTIONS,MYSQL323,MYSQL40
|
||||
sql_mode NO_FIELD_OPTIONS,MYSQL323,MYSQL40,BROKEN_NOT
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
|
@ -173,18 +173,12 @@ SET @`a b`='hello';
|
||||
INSERT INTO t1 VALUES(@`a b`);
|
||||
set @var1= "';aaa";
|
||||
insert into t1 values (@var1);
|
||||
create table t2 (c char(30)) charset=ucs2;
|
||||
set @v=convert('abc' using ucs2);
|
||||
insert into t2 values (@v);
|
||||
show binlog events from 95;
|
||||
Log_name Pos Event_type Server_id End_log_pos Info
|
||||
master-bin.000001 95 User var 1 136 @`a b`=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci
|
||||
master-bin.000001 136 Query 1 222 use `test`; INSERT INTO t1 VALUES(@`a b`)
|
||||
master-bin.000001 222 User var 1 264 @`var1`=_latin1 0x273B616161 COLLATE latin1_swedish_ci
|
||||
master-bin.000001 264 Query 1 350 use `test`; insert into t1 values (@var1)
|
||||
master-bin.000001 350 Query 1 448 use `test`; create table t2 (c char(30)) charset=ucs2
|
||||
master-bin.000001 448 User var 1 488 @`v`=_ucs2 0x006100620063 COLLATE ucs2_general_ci
|
||||
master-bin.000001 488 Query 1 571 use `test`; insert into t2 values (@v)
|
||||
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
|
||||
SET @`a b`:=_latin1 0x68656C6C6F COLLATE latin1_swedish_ci;
|
||||
use test;
|
||||
@ -195,12 +189,7 @@ INSERT INTO t1 VALUES(@`a b`);
|
||||
SET @`var1`:=_latin1 0x273B616161 COLLATE latin1_swedish_ci;
|
||||
SET TIMESTAMP=10000;
|
||||
insert into t1 values (@var1);
|
||||
SET TIMESTAMP=10000;
|
||||
create table t2 (c char(30)) charset=ucs2;
|
||||
SET @`v`:=_ucs2 0x006100620063 COLLATE ucs2_general_ci;
|
||||
SET TIMESTAMP=10000;
|
||||
insert into t2 values (@v);
|
||||
drop table t1, t2;
|
||||
drop table t1;
|
||||
set @var= NULL ;
|
||||
select FIELD( @var,'1it','Hit') as my_column;
|
||||
my_column
|
||||
|
@ -80,3 +80,10 @@ select * from t1 where firstname='john' and firstname = binary 'john';
|
||||
select * from t1 where firstname='John' and firstname like binary 'john';
|
||||
select * from t1 where firstname='john' and firstname like binary 'John';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #6552 CHAR column w/o length is legal, BINARY w/o length is not
|
||||
#
|
||||
create table t1 (a binary);
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
@ -20,6 +20,16 @@ SELECT * FROM t1 where (1 AND a)=0;
|
||||
SELECT * FROM t1 where (1 AND a)=1;
|
||||
SELECT * FROM t1 where (1 AND a) IS NULL;
|
||||
|
||||
# WL#638 - Behaviour of NOT does not follow SQL specification
|
||||
set sql_mode='broken_not';
|
||||
select * from t1 where not a between 2 and 3;
|
||||
set sql_mode=default;
|
||||
select * from t1 where not a between 2 and 3;
|
||||
|
||||
# SQL boolean tests
|
||||
select a, a is false, a is true, a is unknown from t1;
|
||||
select a, a is not false, a is not true, a is not unknown from t1;
|
||||
|
||||
# Verify that NULL optimisation works in AND clause:
|
||||
SET @a=0, @b=0;
|
||||
SELECT * FROM t1 WHERE NULL AND (@a:=@a+1);
|
||||
|
@ -323,3 +323,19 @@ set @str1 = 'select ?';
|
||||
set @str2 = convert(@str1 using ucs2);
|
||||
prepare stmt1 from @str2;
|
||||
execute stmt1 using @ivar;
|
||||
|
||||
#
|
||||
# Check correct binlogging of UCS2 user variables (BUG#3875)
|
||||
#
|
||||
SET TIMESTAMP=10000;
|
||||
create table t2 (c char(30)) charset=ucs2;
|
||||
set @v=convert('abc' using ucs2);
|
||||
reset master;
|
||||
insert into t2 values (@v);
|
||||
show binlog events from 95;
|
||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||
# absolutely need variables names to be quoted and strings to be
|
||||
# escaped).
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
drop table t2;
|
||||
|
@ -295,3 +295,14 @@ insert into t1 (s) values ('p
|
||||
select * from t1 where match(s) against('para' in boolean mode);
|
||||
select * from t1 where match(s) against('par*' in boolean mode);
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# icc -ip bug (ip = interprocedural optimization)
|
||||
# bug#5528
|
||||
#
|
||||
CREATE TABLE t1 (h text, FULLTEXT (h));
|
||||
INSERT INTO t1 VALUES ('Jesses Hasse Ling and his syncopators of Swing');
|
||||
REPAIR TABLE t1;
|
||||
select count(*) from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -598,8 +598,10 @@ drop table t3;
|
||||
# Bug #6142: a problem with the empty innodb table
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
create table t1 (
|
||||
a varchar(30), b varchar(30), primary key(a), key(b)
|
||||
) engine=innodb;
|
||||
--enable_warnings
|
||||
select distinct a from t1;
|
||||
drop table t1;
|
||||
|
@ -3,7 +3,7 @@
|
||||
#
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
drop table if exists t1,t2;
|
||||
--enable_warnings
|
||||
|
||||
create table t1 (a int not null,b int not null, primary key using HASH (a)) engine=heap comment="testing heaps" avg_row_length=100 min_rows=1 max_rows=100;
|
||||
@ -141,3 +141,113 @@ INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
|
||||
DELETE from t1 where a < 100;
|
||||
SELECT * from t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
||||
#
|
||||
# Hash index # records estimate test
|
||||
#
|
||||
create table t1
|
||||
(
|
||||
a char(8) not null,
|
||||
b char(20) not null,
|
||||
c int not null,
|
||||
key (a)
|
||||
) engine=heap;
|
||||
|
||||
insert into t1 values ('aaaa', 'prefill-hash=5',0);
|
||||
insert into t1 values ('aaab', 'prefill-hash=0',0);
|
||||
insert into t1 values ('aaac', 'prefill-hash=7',0);
|
||||
insert into t1 values ('aaad', 'prefill-hash=2',0);
|
||||
insert into t1 values ('aaae', 'prefill-hash=1',0);
|
||||
insert into t1 values ('aaaf', 'prefill-hash=4',0);
|
||||
insert into t1 values ('aaag', 'prefill-hash=3',0);
|
||||
insert into t1 values ('aaah', 'prefill-hash=6',0);
|
||||
|
||||
explain select * from t1 where a='aaaa';
|
||||
explain select * from t1 where a='aaab';
|
||||
explain select * from t1 where a='aaac';
|
||||
explain select * from t1 where a='aaad';
|
||||
insert into t1 select * from t1;
|
||||
|
||||
explain select * from t1 where a='aaaa';
|
||||
explain select * from t1 where a='aaab';
|
||||
explain select * from t1 where a='aaac';
|
||||
explain select * from t1 where a='aaad';
|
||||
|
||||
# a known effect: table reload causes statistics to be updated:
|
||||
flush tables;
|
||||
explain select * from t1 where a='aaaa';
|
||||
explain select * from t1 where a='aaab';
|
||||
explain select * from t1 where a='aaac';
|
||||
explain select * from t1 where a='aaad';
|
||||
|
||||
# Check if delete_all_rows() updates #hash_buckets
|
||||
create table t2 as select * from t1;
|
||||
delete from t1;
|
||||
insert into t1 select * from t2;
|
||||
explain select * from t1 where a='aaaa';
|
||||
explain select * from t1 where a='aaab';
|
||||
explain select * from t1 where a='aaac';
|
||||
explain select * from t1 where a='aaad';
|
||||
drop table t1, t2;
|
||||
|
||||
|
||||
# Btree and hash index use costs.
|
||||
create table t1 (
|
||||
id int unsigned not null primary key auto_increment,
|
||||
name varchar(20) not null,
|
||||
index heap_idx(name),
|
||||
index btree_idx using btree(name)
|
||||
) engine=heap;
|
||||
|
||||
create table t2 (
|
||||
id int unsigned not null primary key auto_increment,
|
||||
name varchar(20) not null,
|
||||
index btree_idx using btree(name),
|
||||
index heap_idx(name)
|
||||
) engine=heap;
|
||||
|
||||
insert into t1 (name) values ('Matt'), ('Lilu'), ('Corbin'), ('Carly'),
|
||||
('Suzy'), ('Hoppy'), ('Burrito'), ('Mimi'), ('Sherry'), ('Ben'), ('Phil'),
|
||||
('Emily'), ('Mike');
|
||||
insert into t2 select * from t1;
|
||||
explain select * from t1 where name='matt';
|
||||
explain select * from t2 where name='matt';
|
||||
|
||||
explain select * from t1 where name='Lilu';
|
||||
explain select * from t2 where name='Lilu';
|
||||
|
||||
explain select * from t1 where name='Phil';
|
||||
explain select * from t2 where name='Phil';
|
||||
|
||||
explain select * from t1 where name='Lilu';
|
||||
explain select * from t2 where name='Lilu';
|
||||
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
insert into t1 (name) select name from t2;
|
||||
flush tables;
|
||||
select count(*) from t1 where name='Matt';
|
||||
explain select * from t1 ignore index (btree_idx) where name='matt';
|
||||
show index from t1;
|
||||
|
||||
show index from t1;
|
||||
|
||||
create table t3
|
||||
(
|
||||
a varchar(20) not null,
|
||||
b varchar(20) not null,
|
||||
key (a,b)
|
||||
) engine=heap;
|
||||
insert into t3 select name, name from t1;
|
||||
show index from t3;
|
||||
show index from t3;
|
||||
|
||||
# test rec_per_key use for joins.
|
||||
explain select * from t1 ignore key(btree_idx), t3 where t1.name='matt' and t3.a = concat('',t1.name) and t3.b=t1.name;
|
||||
|
||||
drop table t1, t2, t3;
|
||||
|
||||
|
@ -104,7 +104,7 @@ information_schema.SCHEMATA b where
|
||||
a.ROUTINE_SCHEMA = b.SCHEMA_NAME;
|
||||
|
||||
select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
|
||||
mysql.proc b where a.ROUTINE_NAME = b.name;
|
||||
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8);
|
||||
select count(*) from information_schema.ROUTINES;
|
||||
|
||||
#
|
||||
@ -222,4 +222,23 @@ create table t1 (a int not null auto_increment,b int, primary key (a));
|
||||
insert into t1 values (1,1),(NULL,3),(NULL,4);
|
||||
select AUTO_INCREMENT from information_schema.tables where table_name = 't1';
|
||||
drop table t1;
|
||||
|
||||
|
||||
create table t1 (s1 int);
|
||||
insert into t1 values (0),(9),(0);
|
||||
select s1 from t1 where s1 in (select version from
|
||||
information_schema.tables) union select version from
|
||||
information_schema.tables;
|
||||
drop table t1;
|
||||
|
||||
SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS;
|
||||
set names latin2;
|
||||
SHOW CREATE TABLE INFORMATION_SCHEMA.CHARACTER_SETS;
|
||||
set names latin1;
|
||||
|
||||
create table t1 select * from information_schema.CHARACTER_SETS
|
||||
where CHARACTER_SET_NAME like "latin1";
|
||||
select * from t1;
|
||||
alter table t1 default character set utf8;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -1180,3 +1180,11 @@ select count(*) from t1 where x = 18446744073709551601;
|
||||
|
||||
drop table t1;
|
||||
|
||||
# Test for testable InnoDB status variables. This test
|
||||
# uses previous ones(pages_created, rows_deleted, ...).
|
||||
show status like "Innodb_buffer_pool_pages_total";
|
||||
show status like "Innodb_page_size";
|
||||
show status like "Innodb_rows_deleted";
|
||||
show status like "Innodb_rows_inserted";
|
||||
show status like "Innodb_rows_read";
|
||||
show status like "Innodb_rows_updated";
|
||||
|
@ -156,3 +156,14 @@ set global keycache2.key_buffer_size=0;
|
||||
# Test to set up a too small size for a key cache (bug #2064)
|
||||
set global keycache3.key_buffer_size=100;
|
||||
set global keycache3.key_buffer_size=0;
|
||||
|
||||
# Test case for buf 6447
|
||||
|
||||
create table t1 (mytext text, FULLTEXT (mytext));
|
||||
insert t1 values ('aaabbb');
|
||||
|
||||
check table t1;
|
||||
set GLOBAL key_cache_block_size=2048;
|
||||
check table t1;
|
||||
|
||||
drop table t1;
|
||||
|
@ -1757,6 +1757,15 @@ drop table t4, t3, t2, t1;
|
||||
DO 1;
|
||||
DO benchmark(100,1+1),1,1;
|
||||
|
||||
#
|
||||
# Bug #6449: do default;
|
||||
#
|
||||
|
||||
--error 1064
|
||||
do default;
|
||||
--error 1054
|
||||
do foobar;
|
||||
|
||||
#
|
||||
# random in WHERE clause
|
||||
#
|
||||
|
@ -109,16 +109,13 @@ SET @`a b`='hello';
|
||||
INSERT INTO t1 VALUES(@`a b`);
|
||||
set @var1= "';aaa";
|
||||
insert into t1 values (@var1);
|
||||
create table t2 (c char(30)) charset=ucs2;
|
||||
set @v=convert('abc' using ucs2);
|
||||
insert into t2 values (@v);
|
||||
show binlog events from 95;
|
||||
# more important than SHOW BINLOG EVENTS, mysqlbinlog (where we
|
||||
# absolutely need variables names to be quoted and strings to be
|
||||
# escaped).
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR
|
||||
--exec $MYSQL_BINLOG --short-form $MYSQL_TEST_DIR/var/log/master-bin.000001
|
||||
drop table t1, t2;
|
||||
drop table t1;
|
||||
|
||||
|
||||
#
|
||||
|
Reference in New Issue
Block a user