mirror of
https://github.com/MariaDB/server.git
synced 2025-12-16 22:03:23 +03:00
Merge jamppa@bk-internal.mysql.com:/home/bk/mysql-5.0
into ua141d10.elisa.omakaista.fi:/home/my/bk/mysql-5.0-tmp
This commit is contained in:
@@ -19,3 +19,26 @@ SELECT * FROM t1 WHERE popisek LIKE '2005-01-1';
|
||||
popisek
|
||||
2005-01-1
|
||||
drop table t1;
|
||||
set names cp1250;
|
||||
CREATE TABLE t1
|
||||
(
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
str VARCHAR(32) CHARACTER SET cp1250 COLLATE cp1250_czech_cs NOT NULL default '',
|
||||
UNIQUE KEY (str)
|
||||
);
|
||||
INSERT INTO t1 VALUES (NULL, 'a');
|
||||
INSERT INTO t1 VALUES (NULL, 'aa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaaa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaaaa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaaaaa');
|
||||
INSERT INTO t1 VALUES (NULL, 'aaaaaaa');
|
||||
select * from t1 where str like 'aa%';
|
||||
id str
|
||||
2 aa
|
||||
3 aaa
|
||||
4 aaaa
|
||||
5 aaaaa
|
||||
6 aaaaaa
|
||||
7 aaaaaaa
|
||||
drop table t1;
|
||||
|
||||
@@ -495,3 +495,11 @@ f1 f2
|
||||
Warnings:
|
||||
Warning 1292 Truncated incorrect date value: '2003-04-05 g'
|
||||
Warning 1292 Truncated incorrect datetime value: '2003-04-05 10:11:12.101010234567'
|
||||
create table t1 (f1 datetime);
|
||||
insert into t1 (f1) values ("2005-01-01");
|
||||
insert into t1 (f1) values ("2005-02-01");
|
||||
select date_format(f1, "%m") as d1, date_format(f1, "%M") as d2 from t1 order by date_format(f1, "%M");
|
||||
d1 d2
|
||||
02 February
|
||||
01 January
|
||||
drop table t1;
|
||||
|
||||
@@ -668,3 +668,21 @@ ERROR 42S22: Unknown column 't2.a' in 'field list'
|
||||
insert into t1 select t2.a from t2 group by t2.a on duplicate key update a= t1.a + t2.b;
|
||||
ERROR 42S22: Unknown column 't2.b' in 'field list'
|
||||
drop table t1,t2,t3;
|
||||
create table t1(f1 varchar(5) key);
|
||||
insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
|
||||
insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
|
||||
insert into t1(f1) select if(max(f1) is null, '2000',max(f1)+1) from t1;
|
||||
select * from t1;
|
||||
f1
|
||||
2000
|
||||
2001
|
||||
2002
|
||||
drop table t1;
|
||||
create table t1(x int, y int);
|
||||
create table t2(x int, z int);
|
||||
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(x);
|
||||
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(z);
|
||||
ERROR 42S22: Unknown column 'z' in 'field list'
|
||||
insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
|
||||
ERROR 42S22: Unknown column 't2.x' in 'field list'
|
||||
drop table t1,t2;
|
||||
|
||||
@@ -669,6 +669,38 @@ 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 10 NULL NULL YES BTREE
|
||||
drop table t1;
|
||||
set myisam_stats_method=nulls_ignored;
|
||||
show variables like 'myisam_stats_method';
|
||||
Variable_name Value
|
||||
myisam_stats_method nulls_ignored
|
||||
create table t1 (
|
||||
a char(3), b char(4), c char(5), d char(6),
|
||||
key(a,b,c,d)
|
||||
);
|
||||
insert into t1 values ('bcd','def1', NULL, 'zz');
|
||||
insert into t1 values ('bcd','def2', NULL, 'zz');
|
||||
insert into t1 values ('bce','def1', 'yuu', NULL);
|
||||
insert into t1 values ('bce','def2', NULL, 'quux');
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze 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 2 NULL NULL YES BTREE
|
||||
t1 1 a 2 b A 4 NULL NULL YES BTREE
|
||||
t1 1 a 3 c A 4 NULL NULL YES BTREE
|
||||
t1 1 a 4 d A 4 NULL NULL YES BTREE
|
||||
delete from t1;
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze 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 0 NULL NULL YES BTREE
|
||||
t1 1 a 2 b A 0 NULL NULL YES BTREE
|
||||
t1 1 a 3 c A 0 NULL NULL YES BTREE
|
||||
t1 1 a 4 d A 0 NULL NULL YES BTREE
|
||||
set myisam_stats_method=DEFAULT;
|
||||
set storage_engine=MyISAM;
|
||||
drop table if exists t1,t2,t3;
|
||||
--- Testing varchar ---
|
||||
|
||||
@@ -2700,6 +2700,14 @@ a b c d
|
||||
1 2 2 1
|
||||
1 2 3 1
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
create table t1 (f1 int primary key, f2 int);
|
||||
create table t2 (f3 int, f4 int, primary key(f3,f4));
|
||||
insert into t1 values (1,1);
|
||||
insert into t2 values (1,1),(1,2);
|
||||
select distinct count(f2) >0 from t1 left join t2 on f1=f3 group by f1;
|
||||
count(f2) >0
|
||||
1
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 ( city char(30) );
|
||||
INSERT INTO t1 VALUES ('London');
|
||||
INSERT INTO t1 VALUES ('Paris');
|
||||
|
||||
@@ -263,8 +263,8 @@ test
|
||||
delete from t1 where count(*)=1;
|
||||
ERROR HY000: Invalid use of group function
|
||||
drop table t1;
|
||||
create table t1 ( a int, index (a) );
|
||||
insert into t1 values (0),(0),(0),(0),(0),(0),(0),(0);
|
||||
create table t1 ( a int, b int default 0, index (a) );
|
||||
insert into t1 (a) values (0),(0),(0),(0),(0),(0),(0),(0);
|
||||
flush status;
|
||||
select a from t1 order by a limit 1;
|
||||
a
|
||||
@@ -278,15 +278,16 @@ Handler_read_prev 0
|
||||
Handler_read_rnd 0
|
||||
Handler_read_rnd_next 0
|
||||
flush status;
|
||||
update t1 set a=unix_timestamp() order by a limit 1;
|
||||
update t1 set a=9999 order by a limit 1;
|
||||
update t1 set b=9999 order by a limit 1;
|
||||
show status like 'handler_read%';
|
||||
Variable_name Value
|
||||
Handler_read_first 1
|
||||
Handler_read_key 0
|
||||
Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 1
|
||||
Handler_read_rnd_next 0
|
||||
Handler_read_rnd 2
|
||||
Handler_read_rnd_next 9
|
||||
flush status;
|
||||
delete from t1 order by a limit 1;
|
||||
show status like 'handler_read%';
|
||||
@@ -318,7 +319,21 @@ Handler_read_next 0
|
||||
Handler_read_prev 0
|
||||
Handler_read_rnd 1
|
||||
Handler_read_rnd_next 9
|
||||
select count(*) from t1;
|
||||
count(*)
|
||||
5
|
||||
select * from t1;
|
||||
a b
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
0 0
|
||||
update t1 set a=a+10,b=1 order by a limit 3;
|
||||
update t1 set a=a+11,b=2 order by a limit 3;
|
||||
update t1 set a=a+12,b=3 order by a limit 3;
|
||||
select * from t1 order by a;
|
||||
a b
|
||||
11 2
|
||||
21 2
|
||||
22 3
|
||||
22 3
|
||||
23 3
|
||||
drop table t1;
|
||||
|
||||
Reference in New Issue
Block a user