mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge sgluhov@bk-internal.mysql.com:/home/bk/mysql-4.0
into gluh.mysql.r18.ru:/home/gluh/mysql-4.0.pass sql/sql_parse.cc: Auto merged
This commit is contained in:
@ -1154,3 +1154,14 @@ x
|
||||
7
|
||||
6
|
||||
drop table t1;
|
||||
create table t1 ( c char(8) not null ) type=bdb;
|
||||
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
||||
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
||||
alter table t1 add b char(8) not null;
|
||||
alter table t1 add a char(8) not null;
|
||||
alter table t1 add primary key (a,b,c);
|
||||
update t1 set a=c, b=c;
|
||||
create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=bdb;
|
||||
insert into t2 select * from t1;
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
|
@ -15,9 +15,11 @@ select 9223372036854775808+1;
|
||||
9223372036854775809
|
||||
drop table if exists t1;
|
||||
create table t1 (a bigint unsigned not null, primary key(a));
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
|
||||
select * from t1;
|
||||
a
|
||||
18446744073709551612
|
||||
18446744073709551613
|
||||
18446744073709551614
|
||||
18446744073709551615
|
||||
select * from t1 where a=18446744073709551615;
|
||||
@ -26,6 +28,8 @@ a
|
||||
delete from t1 where a=18446744073709551615;
|
||||
select * from t1;
|
||||
a
|
||||
18446744073709551612
|
||||
18446744073709551613
|
||||
18446744073709551614
|
||||
drop table t1;
|
||||
create table t1 ( a int not null default 1, big bigint );
|
||||
@ -67,3 +71,13 @@ select * from t1 limit 9999999999;
|
||||
id a
|
||||
9999999999 1
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( quantity decimal(60,0));
|
||||
insert into t1 values (10000000000000000000);
|
||||
insert into t1 values (10000000000000000000.0);
|
||||
insert into t1 values ('10000000000000000000');
|
||||
select * from t1;
|
||||
quantity
|
||||
-8446744073709551616
|
||||
10000000000000000000
|
||||
10000000000000000000
|
||||
drop table t1;
|
||||
|
@ -134,6 +134,23 @@ Only MyISAM tables support collections
|
||||
Function MATCH ... AGAINST() is used to do a search
|
||||
some test foobar implements vector space model
|
||||
drop table t1;
|
||||
create table t1 (a varchar(200) not null, fulltext (a));
|
||||
insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
|
||||
select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
|
||||
a
|
||||
aaa10 bbb20
|
||||
aaa20 bbb15
|
||||
aaa30 bbb10
|
||||
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
|
||||
a
|
||||
aaa20 bbb15
|
||||
aaa30 bbb10
|
||||
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
|
||||
a
|
||||
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
|
||||
a
|
||||
aaa10 bbb20
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (
|
||||
id int(11),
|
||||
ticket int(11),
|
||||
|
@ -41,4 +41,12 @@ venue_id venue_text dt name entity_id
|
||||
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
|
||||
venue_id venue_text dt name entity_id
|
||||
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
|
||||
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
|
||||
venue_id venue_text dt name entity_id
|
||||
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
|
||||
NULL a2 2003-05-23 19:30:00 NULL NULL
|
||||
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
|
||||
venue_id venue_text dt name entity_id
|
||||
1 a1 2003-05-23 19:30:00 aberdeen town hall 1
|
||||
NULL a2 2003-05-23 19:30:00 NULL NULL
|
||||
drop table t1,t2;
|
||||
|
@ -47,7 +47,7 @@ sum(all a) count(all a) avg(all a) std(all a) bit_or(all a) bit_and(all a) min(a
|
||||
21 6 3.5000 1.7078 7 0 1 6 E
|
||||
select grp, sum(a),count(a),avg(a),std(a),bit_or(a),bit_and(a),min(a),max(a),min(c),max(c) from t1 group by grp;
|
||||
grp sum(a) count(a) avg(a) std(a) bit_or(a) bit_and(a) min(a) max(a) min(c) max(c)
|
||||
NULL NULL 0 NULL NULL 0 0 NULL NULL
|
||||
NULL NULL 0 NULL NULL 0 18446744073709551615 NULL NULL
|
||||
1 1 1 1.0000 0.0000 1 1 1 1 a a
|
||||
2 5 2 2.5000 0.5000 3 2 2 3 b c
|
||||
3 15 3 5.0000 0.8165 7 4 4 6 C E
|
||||
@ -218,8 +218,8 @@ insert into t1 values (1,null);
|
||||
insert into t1 values (2,null);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 0 0
|
||||
2 0 NULL NULL NULL NULL NULL 0 0
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL -1 0
|
||||
@ -227,8 +227,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
insert into t1 values (2,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 0 0
|
||||
2 1 1 1.0000 0.0000 1 1 0 1
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL -1 0
|
||||
@ -236,8 +236,8 @@ a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
insert into t1 values (3,1);
|
||||
select a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
1 0 NULL NULL NULL NULL NULL 0 0
|
||||
2 1 1 1.0000 0.0000 1 1 0 1
|
||||
1 0 NULL NULL NULL NULL NULL 18446744073709551615 0
|
||||
2 1 1 1.0000 0.0000 1 1 1 1
|
||||
3 1 1 1.0000 0.0000 1 1 1 1
|
||||
select SQL_BIG_RESULT a,count(b), sum(b), avg(b), std(b), min(b), max(b), bit_and(b), bit_or(b) from t1 group by a;
|
||||
a count(b) sum(b) avg(b) std(b) min(b) max(b) bit_and(b) bit_or(b)
|
||||
|
@ -119,12 +119,12 @@ montymontymontymontymonty * *
|
||||
select reverse('abc'),reverse('abcd');
|
||||
reverse('abc') reverse('abcd')
|
||||
cba dcba
|
||||
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12');
|
||||
rpad('a',4,'1') rpad('a',4,'12') rpad('abcd',3,'12')
|
||||
a111 a121 abc
|
||||
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12');
|
||||
lpad('a',4,'1') lpad('a',4,'12') lpad('abcd',3,'12')
|
||||
111a 121a abc
|
||||
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
|
||||
rpad('a',4,'1') rpad('a',4,'12') rpad('abcd',3,'12') rpad(11, 10 , 22) rpad("ab", 10, 22)
|
||||
a111 a121 abc 1122222222 ab22222222
|
||||
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22);
|
||||
lpad('a',4,'1') lpad('a',4,'12') lpad('abcd',3,'12') lpad(11, 10 , 22)
|
||||
111a 121a abc 2222222211
|
||||
select rpad(741653838,17,'0'),lpad(741653838,17,'0');
|
||||
rpad(741653838,17,'0') lpad(741653838,17,'0')
|
||||
74165383800000000 00000000741653838
|
||||
@ -134,6 +134,12 @@ abcdaba abaabcd
|
||||
select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
|
||||
rpad('abcd',1,'ab') lpad('abcd',1,'ab')
|
||||
a a
|
||||
select rpad('STRING', 20, CONCAT('p','a','d') );
|
||||
rpad('STRING', 20, CONCAT('p','a','d') )
|
||||
STRINGpadpadpadpadpa
|
||||
select lpad('STRING', 20, CONCAT('p','a','d') );
|
||||
lpad('STRING', 20, CONCAT('p','a','d') )
|
||||
padpadpadpadpaSTRING
|
||||
select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
|
||||
LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD') GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD')
|
||||
HAROLD HARRY
|
||||
|
@ -1222,3 +1222,14 @@ a b
|
||||
111 100
|
||||
111 100
|
||||
drop table t1;
|
||||
create table t1 ( c char(8) not null ) type=innodb;
|
||||
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
||||
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
||||
alter table t1 add b char(8) not null;
|
||||
alter table t1 add a char(8) not null;
|
||||
alter table t1 add primary key (a,b,c);
|
||||
update t1 set a=c, b=c;
|
||||
create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=innodb;
|
||||
insert into t2 select * from t1;
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
|
@ -542,3 +542,7 @@ a b
|
||||
1 2
|
||||
5 NULL
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
SET @id=0;
|
||||
UPDATE t1 SET a=0 ORDER BY (a=@id), b;
|
||||
DROP TABLE t1;
|
||||
|
@ -290,3 +290,13 @@ t1 range a,b a 5 NULL 2 Using where
|
||||
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||
a b
|
||||
DROP TABLE t1;
|
||||
CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b));
|
||||
INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0);
|
||||
INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0);
|
||||
SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1);
|
||||
COUNT(*)
|
||||
6
|
||||
SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1);
|
||||
COUNT(*)
|
||||
6
|
||||
DROP TABLE t1;
|
||||
|
32
mysql-test/r/rpl_change_master.result
Normal file
32
mysql-test/r/rpl_change_master.result
Normal file
@ -0,0 +1,32 @@
|
||||
slave stop;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
select get_lock("a",5);
|
||||
get_lock("a",5)
|
||||
1
|
||||
create table t1(n int);
|
||||
insert into t1 values(1+get_lock("a",15)*0);
|
||||
insert into t1 values(2);
|
||||
stop slave;
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
127.0.0.1 root MASTER_MYPORT 1 master-bin.001 273 slave-relay-bin.002 255 master-bin.001 No No 0 0 214 314
|
||||
change master to master_user='root';
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
127.0.0.1 root MASTER_MYPORT 1 master-bin.001 214 slave-relay-bin.001 4 master-bin.001 No No 0 0 214 4
|
||||
select release_lock("a");
|
||||
release_lock("a")
|
||||
1
|
||||
start slave;
|
||||
select * from t1;
|
||||
n
|
||||
1
|
||||
2
|
||||
drop table t1;
|
@ -43,7 +43,7 @@ change master to master_user='test';
|
||||
change master to master_user='root';
|
||||
show slave status;
|
||||
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
|
||||
127.0.0.1 root MASTER_PORT 1 master-bin.001 1442 slave-relay-bin.001 4 master-bin.001 No No 0 0 1442 4
|
||||
127.0.0.1 root MASTER_PORT 1 master-bin.001 1419 slave-relay-bin.001 4 master-bin.001 No No 0 0 1419 4
|
||||
set global sql_slave_skip_counter=1;
|
||||
start slave;
|
||||
set sql_log_bin=0;
|
||||
|
27
mysql-test/r/rpl_multi_update.result
Normal file
27
mysql-test/r/rpl_multi_update.result
Normal file
@ -0,0 +1,27 @@
|
||||
slave stop;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
reset master;
|
||||
reset slave;
|
||||
drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
|
||||
slave start;
|
||||
drop table if exists t1,t2;
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
) TYPE=MyISAM;
|
||||
CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) TYPE=MyISAM;
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
a b
|
||||
1 0
|
||||
2 0
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
a b
|
||||
1 0
|
||||
2 1
|
||||
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
|
@ -1,6 +1,6 @@
|
||||
drop table if exists t1;
|
||||
create table t1 (t datetime);
|
||||
insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959);
|
||||
insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
|
||||
select * from t1;
|
||||
t
|
||||
2000-01-01 00:00:00
|
||||
@ -15,6 +15,11 @@ t
|
||||
1999-12-31 23:59:59
|
||||
1000-01-01 00:00:00
|
||||
9999-12-31 23:59:59
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
delete from t1 where t > 0;
|
||||
optimize table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
@ -22,7 +27,8 @@ test.t1 optimize status OK
|
||||
check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959");
|
||||
delete from t1;
|
||||
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
|
||||
select * from t1;
|
||||
t
|
||||
2000-01-01 00:00:00
|
||||
@ -38,6 +44,11 @@ t
|
||||
1999-12-31 23:59:59
|
||||
1000-01-01 00:00:00
|
||||
9999-12-31 23:59:59
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
0000-00-00 00:00:00
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a timestamp, b date, c time, d datetime);
|
||||
insert into t1 (b,c,d) values(now(),curtime(),now());
|
||||
|
@ -43,7 +43,7 @@ date_format(a,"%Y %y") year(a) year(now())
|
||||
1970 70 1970 1970
|
||||
drop table t1;
|
||||
create table t1 (ix timestamp);
|
||||
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
|
||||
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101);
|
||||
select * from t1;
|
||||
ix
|
||||
19991101000000
|
||||
@ -55,6 +55,24 @@ ix
|
||||
19990501000000
|
||||
19991101000000
|
||||
19990501000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
delete from t1;
|
||||
insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101");
|
||||
select * from t1;
|
||||
ix
|
||||
19991101000000
|
||||
19990102030405
|
||||
19990630232922
|
||||
19990601000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
00000000000000
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
|
||||
INSERT INTO t1 VALUES ("1998-12-31","1998-12-31 23:59:59",19981231235959);
|
||||
|
@ -97,3 +97,22 @@ drop table t1;
|
||||
select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;
|
||||
@a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b @a:=10 @b:=2 @a>@b @a:="10" @b:="2" @a>@b
|
||||
10 2 1 10 2 1 10 2 1 10 2 1
|
||||
create table t1 (i int not null);
|
||||
insert t1 values (1),(2),(2),(3),(3),(3);
|
||||
select @a:=0;
|
||||
@a:=0
|
||||
0
|
||||
select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
|
||||
@a @a:=@a+count(*) count(*) @a
|
||||
0 1 1 0
|
||||
0 2 2 0
|
||||
0 3 3 0
|
||||
select @a:=0;
|
||||
@a:=0
|
||||
0
|
||||
select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
|
||||
@a+0 @a:=@a+0+count(*) count(*) @a+0
|
||||
0 1 1 0
|
||||
1 3 2 0
|
||||
3 6 3 0
|
||||
drop table t1;
|
||||
|
@ -796,3 +796,22 @@ select * from t1 where x <= 10 and x >= 7 order by x desc;
|
||||
select * from t1 where x <= 8 and x >= 5 order by x desc;
|
||||
select * from t1 where x < 8 and x > 5 order by x desc;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of multi-table-updates (bug #1980).
|
||||
#
|
||||
|
||||
create table t1 ( c char(8) not null ) type=bdb;
|
||||
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
||||
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
||||
|
||||
alter table t1 add b char(8) not null;
|
||||
alter table t1 add a char(8) not null;
|
||||
alter table t1 add primary key (a,b,c);
|
||||
update t1 set a=c, b=c;
|
||||
|
||||
create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=bdb;
|
||||
insert into t2 select * from t1;
|
||||
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
|
@ -14,7 +14,7 @@ select 9223372036854775808+1;
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1 (a bigint unsigned not null, primary key(a));
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE);
|
||||
insert into t1 values (18446744073709551615), (0xFFFFFFFFFFFFFFFE), (18446744073709551613), (18446744073709551612);
|
||||
select * from t1;
|
||||
select * from t1 where a=18446744073709551615;
|
||||
# select * from t1 where a='18446744073709551615';
|
||||
@ -46,3 +46,17 @@ insert into t1 values (null,1);
|
||||
select * from t1;
|
||||
select * from t1 limit 9999999999;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Item_uint::save_to_field()
|
||||
# BUG#1845
|
||||
# This can't be fixed in MySQL 4.0 without loosing precisions for bigints
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( quantity decimal(60,0));
|
||||
insert into t1 values (10000000000000000000);
|
||||
insert into t1 values (10000000000000000000.0);
|
||||
insert into t1 values ('10000000000000000000');
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -70,6 +70,17 @@ delete from t1 where MATCH(a,b) AGAINST ("indexes");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# why to scan strings for trunc*
|
||||
#
|
||||
create table t1 (a varchar(200) not null, fulltext (a));
|
||||
insert t1 values ("aaa10 bbb20"), ("aaa20 bbb15"), ("aaa30 bbb10");
|
||||
select * from t1 where match a against ("+aaa* +bbb*" in boolean mode);
|
||||
select * from t1 where match a against ("+aaa* +bbb1*" in boolean mode);
|
||||
select * from t1 where match a against ("+aaa* +ccc*" in boolean mode);
|
||||
select * from t1 where match a against ("+aaa10 +(bbb*)" in boolean mode);
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Check bug reported by Matthias Urlichs
|
||||
#
|
||||
|
@ -38,5 +38,7 @@ create table t2 (name varchar(255) not null default '', entity_id int(11) not nu
|
||||
insert into t2 (name, entity_id) values ('aberdeen town hall', 1), ('glasgow royal concert hall', 2), ('queen\'s hall, edinburgh', 3);
|
||||
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen' in boolean mode) and dt = '2003-05-23 19:30:00';
|
||||
select * from t1 left join t2 on venue_id = entity_id where match(name) against('aberdeen') and dt = '2003-05-23 19:30:00';
|
||||
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen' in boolean mode)) where dt = '2003-05-23 19:30:00';
|
||||
select * from t1 left join t2 on (venue_id = entity_id and match(name) against('aberdeen')) where dt = '2003-05-23 19:30:00';
|
||||
drop table t1,t2;
|
||||
|
||||
|
@ -49,11 +49,13 @@ select aes_decrypt("a","a");
|
||||
select aes_decrypt(aes_encrypt("","a"),"a");
|
||||
select repeat('monty',5),concat('*',space(5),'*');
|
||||
select reverse('abc'),reverse('abcd');
|
||||
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12');
|
||||
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12');
|
||||
select rpad('a',4,'1'),rpad('a',4,'12'),rpad('abcd',3,'12'), rpad(11, 10 , 22), rpad("ab", 10, 22);
|
||||
select lpad('a',4,'1'),lpad('a',4,'12'),lpad('abcd',3,'12'), lpad(11, 10 , 22);
|
||||
select rpad(741653838,17,'0'),lpad(741653838,17,'0');
|
||||
select rpad('abcd',7,'ab'),lpad('abcd',7,'ab');
|
||||
select rpad('abcd',1,'ab'),lpad('abcd',1,'ab');
|
||||
select rpad('STRING', 20, CONCAT('p','a','d') );
|
||||
select lpad('STRING', 20, CONCAT('p','a','d') );
|
||||
|
||||
select LEAST(NULL,'HARRY','HARRIOT',NULL,'HAROLD'),GREATEST(NULL,'HARRY','HARRIOT',NULL,'HAROLD');
|
||||
select least(1,2,3) | greatest(16,32,8), least(5,4)*1,greatest(-1.0,1.0)*1,least(3,2,1)*1.0,greatest(1,1.1,1.0),least("10",9),greatest("A","B","0");
|
||||
|
@ -838,3 +838,22 @@ update t1 set b=100 where a=1 order by b desc limit 2;
|
||||
update t1 set a=a+10+b where a=1 order by b;
|
||||
select * from t1 order by a,b;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test of multi-table-updates (bug #1980).
|
||||
#
|
||||
|
||||
create table t1 ( c char(8) not null ) type=innodb;
|
||||
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
|
||||
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
|
||||
|
||||
alter table t1 add b char(8) not null;
|
||||
alter table t1 add a char(8) not null;
|
||||
alter table t1 add primary key (a,b,c);
|
||||
update t1 set a=c, b=c;
|
||||
|
||||
create table t2 (c char(8) not null, b char(8) not null, a char(8) not null, primary key(a,b,c)) type=innodb;
|
||||
insert into t2 select * from t1;
|
||||
|
||||
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
|
||||
drop table t1,t2;
|
||||
|
@ -345,3 +345,11 @@ SELECT * FROM t1 ORDER BY (a + b);
|
||||
SELECT * FROM t1 ORDER BY (a + b) DESC;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #1945 - Crashing bug with bad User Variables in UPDATE ... ORDER BY ...
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT);
|
||||
SET @id=0;
|
||||
UPDATE t1 SET a=0 ORDER BY (a=@id), b;
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@ -231,9 +231,20 @@ INSERT INTO t1 VALUES
|
||||
(21,4),(22,5),(23,5),(24,5),(25,5),(26,5),(30,5),(31,5),(32,5),(33,5),
|
||||
(33,5),(33,5),(33,5),(33,5),(34,5),(35,5);
|
||||
|
||||
# we expect that optimizer will choose index on A
|
||||
EXPLAIN SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||
SELECT * FROM t1 WHERE a IN(1,2) AND b=5;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# we expect that optimizer will choose index on A
|
||||
#
|
||||
# Test error with
|
||||
#
|
||||
|
||||
CREATE TABLE t1 (a int, b int, c int, INDEX (c,a,b));
|
||||
INSERT INTO t1 VALUES (1,0,0),(1,0,0),(1,0,0);
|
||||
INSERT INTO t1 VALUES (0,1,0),(0,1,0),(0,1,0);
|
||||
# -- First reports 3; second reports 6
|
||||
SELECT COUNT(*) FROM t1 WHERE (c=0 and a=1) or (c=0 and b=1);
|
||||
SELECT COUNT(*) FROM t1 WHERE (c=0 and b=1) or (c=0 and a=1);
|
||||
DROP TABLE t1;
|
||||
|
28
mysql-test/t/rpl_change_master.test
Normal file
28
mysql-test/t/rpl_change_master.test
Normal file
@ -0,0 +1,28 @@
|
||||
source include/master-slave.inc;
|
||||
|
||||
connection slave;
|
||||
select get_lock("a",5);
|
||||
connection master;
|
||||
create table t1(n int);
|
||||
insert into t1 values(1+get_lock("a",15)*0);
|
||||
insert into t1 values(2);
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
--real_sleep 3; # can't sync_with_master as we should be blocked
|
||||
stop slave;
|
||||
select * from t1;
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
show slave status;
|
||||
change master to master_user='root';
|
||||
--replace_result $MASTER_MYPORT MASTER_MYPORT
|
||||
show slave status;
|
||||
# Will restart from after the values(2), which is bug
|
||||
select release_lock("a");
|
||||
start slave;
|
||||
sync_with_master;
|
||||
select * from t1;
|
||||
connection master;
|
||||
drop table t1;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
25
mysql-test/t/rpl_multi_update.test
Normal file
25
mysql-test/t/rpl_multi_update.test
Normal file
@ -0,0 +1,25 @@
|
||||
source include/master-slave.inc;
|
||||
drop table if exists t1,t2;
|
||||
|
||||
CREATE TABLE t1 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned,
|
||||
) TYPE=MyISAM;
|
||||
|
||||
CREATE TABLE t2 (
|
||||
a int unsigned not null auto_increment primary key,
|
||||
b int unsigned
|
||||
) TYPE=MyISAM;
|
||||
|
||||
INSERT INTO t1 VALUES (NULL, 0);
|
||||
INSERT INTO t1 SELECT NULL, 0 FROM t1;
|
||||
|
||||
INSERT INTO t2 VALUES (NULL, 0), (NULL,1);
|
||||
|
||||
SELECT * FROM t1 ORDER BY a;
|
||||
SELECT * FROM t2 ORDER BY a;
|
||||
|
||||
UPDATE t1, t2 SET t1.b = t2.b WHERE t1.a = t2.a;
|
||||
save_master_pos;
|
||||
connection slave;
|
||||
sync_with_master;
|
@ -4,12 +4,13 @@
|
||||
|
||||
drop table if exists t1;
|
||||
create table t1 (t datetime);
|
||||
insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959);
|
||||
insert into t1 values(101),(691231),(700101),(991231),(10000101),(99991231),(101000000),(691231000000),(700101000000),(991231235959),(10000101000000),(99991231235959),(20030102030460),(20030102036301),(20030102240401),(20030132030401),(20031302030460);
|
||||
select * from t1;
|
||||
delete from t1 where t > 0;
|
||||
optimize table t1;
|
||||
check table t1;
|
||||
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959");
|
||||
delete from t1;
|
||||
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030102030460"),("20030102036301"),("20030102240401"),("20030132030401"),("20031302030460");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
|
@ -34,8 +34,11 @@ select date_format(a,"%Y %y"),year(a),year(now()) from t1;
|
||||
drop table t1;
|
||||
|
||||
create table t1 (ix timestamp);
|
||||
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000);
|
||||
select * from t1;
|
||||
insert into t1 values (19991101000000),(19990102030405),(19990630232922),(19990601000000),(19990930232922),(19990531232922),(19990501000000),(19991101000000),(19990501000000),(20030101010160),(20030101016001),(20030101240101),(20030132010101),(20031301010101);
|
||||
select * from t1;
|
||||
delete from t1;
|
||||
insert into t1 values ("19991101000000"),("19990102030405"),("19990630232922"),("19990601000000"),("20030101010160"),("20030101016001"),("20030101240101"),("20030132010101"),("20031301010101");
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
CREATE TABLE t1 (date date, date_time datetime, time_stamp timestamp);
|
||||
|
@ -53,3 +53,14 @@ drop table t1;
|
||||
|
||||
# just for fun :)
|
||||
select @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b, @a:=10, @b:=2, @a>@b, @a:="10", @b:="2", @a>@b;
|
||||
|
||||
#
|
||||
# bug#1739
|
||||
# Item_func_set_user_var sets update_query_id, Item_func_get_user_var checks it
|
||||
#
|
||||
create table t1 (i int not null);
|
||||
insert t1 values (1),(2),(2),(3),(3),(3);
|
||||
select @a:=0; select @a, @a:=@a+count(*), count(*), @a from t1 group by i;
|
||||
select @a:=0; select @a+0, @a:=@a+0+count(*), count(*), @a+0 from t1 group by i;
|
||||
drop table t1;
|
||||
|
||||
|
Reference in New Issue
Block a user