mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Merge rurik.mysql.com:/home/igor/mysql-5.0
into rurik.mysql.com:/home/igor/dev/mysql-5.0-2 sql/item.cc: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_sum.cc: Auto merged sql/item_sum.h: Auto merged sql/mysql_priv.h: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_lex.h: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged
This commit is contained in:
@ -556,3 +556,9 @@ ERROR 3D000: No database selected
|
||||
alter table test.t1 rename test.t1;
|
||||
use test;
|
||||
drop table t1;
|
||||
create table t1 (mycol int(10) not null);
|
||||
alter table t1 alter column mycol set default 0;
|
||||
desc t1;
|
||||
Field Type Null Key Default Extra
|
||||
mycol int(10) NO 0
|
||||
drop table t1;
|
||||
|
@ -30,6 +30,15 @@ check table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 check status OK
|
||||
drop table t1;
|
||||
create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam;
|
||||
insert into t1 values ('hello');
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status OK
|
||||
analyze table t1;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 analyze status Table is already up to date
|
||||
drop table t1;
|
||||
CREATE TABLE t1 (a int);
|
||||
prepare stmt1 from "SELECT * FROM t1 PROCEDURE ANALYSE()";
|
||||
execute stmt1;
|
||||
|
@ -1891,3 +1891,17 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=BerkeleyDB DEFAULT CHARSET=latin1
|
||||
drop table t1;
|
||||
set storage_engine=MyISAM;
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
key (a,b,c,d)) engine=bdb;
|
||||
drop table t1;
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
e varchar(255) character set utf8,
|
||||
key (a,b,c,d,e)) engine=bdb;
|
||||
ERROR 42000: Specified key was too long; max key length is 3072 bytes
|
||||
End of 5.0 tests
|
||||
|
@ -743,3 +743,22 @@ t2 CREATE TABLE `t2` (
|
||||
`a2` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
drop table t1, t2;
|
||||
create table t1 (i int) engine=myisam max_rows=100000000000;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
|
||||
alter table t1 max_rows=100;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=100
|
||||
alter table t1 max_rows=100000000000;
|
||||
show create table t1;
|
||||
Table Create Table
|
||||
t1 CREATE TABLE `t1` (
|
||||
`i` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=4294967295
|
||||
drop table t1;
|
||||
|
@ -181,11 +181,18 @@ select * from t1 where a=_koi8r'
|
||||
a
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
select * from t1 where a=concat(_koi8r'<27><><EFBFBD><EFBFBD>');
|
||||
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '='
|
||||
a
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
select * from t1 where a=_latin1'<27><><EFBFBD><EFBFBD>';
|
||||
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
create table t1 (a char(10) character set utf8 collate utf8_bin);
|
||||
insert into t1 values (' xxx');
|
||||
select * from t1 where a=lpad('xxx',10,' ');
|
||||
a
|
||||
xxx
|
||||
drop table t1;
|
||||
set names koi8r;
|
||||
create table t1 (c1 char(10) character set cp1251);
|
||||
insert into t1 values ('<27>');
|
||||
|
@ -1095,6 +1095,11 @@ char(0xff,0x8f using utf8)
|
||||
<EFBFBD><EFBFBD>
|
||||
Warnings:
|
||||
Warning 1300 Invalid utf8 character string: 'FF8F'
|
||||
select convert(char(0xff,0x8f) using utf8);
|
||||
convert(char(0xff,0x8f) using utf8)
|
||||
<EFBFBD><EFBFBD>
|
||||
Warnings:
|
||||
Warning 1300 Invalid utf8 character string: 'FF8F'
|
||||
set sql_mode=traditional;
|
||||
select char(0xff,0x8f using utf8);
|
||||
char(0xff,0x8f using utf8)
|
||||
@ -1116,6 +1121,11 @@ char(2557 using utf8)
|
||||
NULL
|
||||
Warnings:
|
||||
Error 1300 Invalid utf8 character string: 'FD'
|
||||
select convert(char(0xff,0x8f) using utf8);
|
||||
convert(char(0xff,0x8f) using utf8)
|
||||
NULL
|
||||
Warnings:
|
||||
Error 1300 Invalid utf8 character string: 'FF8F'
|
||||
select hex(convert(char(2557 using latin1) using utf8));
|
||||
hex(convert(char(2557 using latin1) using utf8))
|
||||
09C3BD
|
||||
|
@ -433,4 +433,7 @@ INSERT INTO t1 VALUES('testword\'\'');
|
||||
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
||||
a
|
||||
testword''
|
||||
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
|
||||
a
|
||||
testword''
|
||||
DROP TABLE t1;
|
||||
|
@ -33,3 +33,12 @@ id value
|
||||
select * from t1 where id <=> value or value<=>id;
|
||||
id value
|
||||
drop table t1,t2;
|
||||
create table t1 (a bigint unsigned);
|
||||
insert into t1 values (4828532208463511553);
|
||||
select * from t1 where a = '4828532208463511553';
|
||||
a
|
||||
4828532208463511553
|
||||
select * from t1 where a in ('4828532208463511553');
|
||||
a
|
||||
4828532208463511553
|
||||
drop table t1;
|
||||
|
@ -594,3 +594,24 @@ flush privileges;
|
||||
set @user123="non-existent";
|
||||
select * from mysql.db where user=@user123;
|
||||
Host Db User Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Grant_priv References_priv Index_priv Alter_priv Create_tmp_table_priv Lock_tables_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Execute_priv
|
||||
set names koi8r;
|
||||
create database <20><>;
|
||||
grant select on <20><>.* to root@localhost;
|
||||
select hex(Db) from mysql.db where Db='<27><>';
|
||||
hex(Db)
|
||||
D0B1D0B4
|
||||
show grants for root@localhost;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT ON `<60><>`.* TO 'root'@'localhost'
|
||||
flush privileges;
|
||||
show grants for root@localhost;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
GRANT SELECT ON `<60><>`.* TO 'root'@'localhost'
|
||||
drop database <20><>;
|
||||
revoke all privileges on <20><>.* from root@localhost;
|
||||
show grants for root@localhost;
|
||||
Grants for root@localhost
|
||||
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION
|
||||
set names latin1;
|
||||
|
@ -2002,3 +2002,44 @@ a count(a)
|
||||
1 1
|
||||
NULL 1
|
||||
drop table t1;
|
||||
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
|
||||
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
|
||||
alter table t1 drop primary key, add primary key (f2, f1);
|
||||
explain select distinct f1 a, f1 b from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 index NULL PRIMARY 5 NULL 4 Using index; Using temporary
|
||||
explain select distinct f1, f2 from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 range NULL PRIMARY 5 NULL 3 Using index for group-by; Using temporary
|
||||
drop table t1;
|
||||
create table t1 (c1 int not null,c2 int not null, primary key(c1,c2));
|
||||
insert into t1 (c1,c2) values
|
||||
(10,1),(10,2),(10,3),(20,4),(20,5),(20,6),(30,7),(30,8),(30,9);
|
||||
select distinct c1, c2 from t1 order by c2;
|
||||
c1 c2
|
||||
10 1
|
||||
10 2
|
||||
10 3
|
||||
20 4
|
||||
20 5
|
||||
20 6
|
||||
30 7
|
||||
30 8
|
||||
30 9
|
||||
select c1,min(c2) as c2 from t1 group by c1 order by c2;
|
||||
c1 c2
|
||||
10 1
|
||||
20 4
|
||||
30 7
|
||||
select c1,c2 from t1 group by c1,c2 order by c2;
|
||||
c1 c2
|
||||
10 1
|
||||
10 2
|
||||
10 3
|
||||
20 4
|
||||
20 5
|
||||
20 6
|
||||
30 7
|
||||
30 8
|
||||
30 9
|
||||
drop table t1;
|
||||
|
@ -1048,3 +1048,11 @@ blob 65535 65535
|
||||
text 65535 65535
|
||||
text 65535 32767
|
||||
drop table t1;
|
||||
create table t1 (f1 int(11));
|
||||
create view v1 as select * from t1;
|
||||
drop table t1;
|
||||
select table_type from information_schema.tables
|
||||
where table_name="v1";
|
||||
table_type
|
||||
VIEW
|
||||
drop view v1;
|
||||
|
@ -2772,3 +2772,17 @@ insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
commit;
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
key (a,b,c,d)) engine=innodb;
|
||||
drop table t1;
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
e varchar(255) character set utf8,
|
||||
key (a,b,c,d,e)) engine=innodb;
|
||||
ERROR 42000: Specified key was too long; max key length is 3072 bytes
|
||||
End of 5.0 tests
|
||||
|
@ -391,3 +391,304 @@ i i i
|
||||
2 NULL 4
|
||||
2 2 2
|
||||
drop table t1,t2,t3;
|
||||
create table t1 (c int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (b int, c int);
|
||||
create table t4 (y int, c int);
|
||||
create table t5 (y int, z int);
|
||||
create table t6 (a int, c int);
|
||||
insert into t1 values (10,1);
|
||||
insert into t1 values (3 ,1);
|
||||
insert into t1 values (3 ,2);
|
||||
insert into t2 values (2, 1);
|
||||
insert into t3 values (1, 3);
|
||||
insert into t3 values (1,10);
|
||||
insert into t4 values (11,3);
|
||||
insert into t4 values (2, 3);
|
||||
insert into t5 values (11,4);
|
||||
insert into t6 values (2, 3);
|
||||
create algorithm=merge view v1a as
|
||||
select * from t1 natural join t2;
|
||||
create algorithm=merge view v1b(a,b,c) as
|
||||
select * from t1 natural join t2;
|
||||
create algorithm=merge view v1c as
|
||||
select b as a, c as b, a as c from t1 natural join t2;
|
||||
create algorithm=merge view v1d(b, a, c) as
|
||||
select a as c, c as b, b as a from t1 natural join t2;
|
||||
create algorithm=merge view v2a as
|
||||
select t1.c, t1.b, t2.a from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
create algorithm=merge view v2b as
|
||||
select t1.c as b, t1.b as a, t2.a as c
|
||||
from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
create algorithm=merge view v3a as
|
||||
select * from t1 natural join t2 natural join t3;
|
||||
create algorithm=merge view v3b as
|
||||
select * from t1 natural join (t2 natural join t3);
|
||||
create algorithm=merge view v4 as
|
||||
select * from v2a natural join v3a;
|
||||
select * from (t1 natural join t2) natural join (t3 natural join t4);
|
||||
b c a y
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (t1 natural join t2) natural left join (t3 natural join t4);
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (t3 natural join t4) natural right join (t1 natural join t2);
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (t1 natural left join t2) natural left join (t3 natural left join t4);
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
2 3 NULL NULL
|
||||
select * from (t4 natural right join t3) natural right join (t2 natural right join t1);
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
2 3 NULL NULL
|
||||
select * from t1 natural join t2 natural join t3 natural join t4;
|
||||
c b a y
|
||||
3 1 2 11
|
||||
3 1 2 2
|
||||
select * from ((t1 natural join t2) natural join t3) natural join t4;
|
||||
c b a y
|
||||
3 1 2 11
|
||||
3 1 2 2
|
||||
select * from t1 natural join (t2 natural join (t3 natural join t4));
|
||||
c b a y
|
||||
3 1 2 11
|
||||
3 1 2 2
|
||||
select * from t5 natural right join (t4 natural right join ((t2 natural right join t1) natural right join t3));
|
||||
y c b a z
|
||||
11 3 1 2 4
|
||||
2 3 1 2 NULL
|
||||
NULL 10 1 2 NULL
|
||||
select * from (t1 natural join t2), (t3 natural join t4);
|
||||
b c a c b y
|
||||
1 10 2 3 1 11
|
||||
1 10 2 3 1 2
|
||||
1 3 2 3 1 11
|
||||
1 3 2 3 1 2
|
||||
select * from (t1 join t2 using (b)) join (t3 join t4 using (c)) using (c);
|
||||
c b a b y
|
||||
3 1 2 1 11
|
||||
3 1 2 1 2
|
||||
select * from (t1 join t2 using (b)) natural join (t3 join t4 using (c));
|
||||
b c a y
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select a,b,c from (t1 natural join t2) natural join (t3 natural join t4)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a having min(b) < max(y) order by a;
|
||||
a b c
|
||||
2 1 3
|
||||
select * from (t1 natural join t2) natural left join (t3 natural join t4)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
|
||||
b c a y
|
||||
1 3 2 2
|
||||
1 3 2 11
|
||||
select * from (t3 natural join t4) natural right join (t1 natural join t2)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
|
||||
b c a y
|
||||
1 3 2 2
|
||||
1 3 2 11
|
||||
select * from t1 natural join t2 where t1.c > t2.a;
|
||||
b c a
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from t1 natural join t2 where t1.b > t2.b;
|
||||
b c a
|
||||
select * from t1 natural left join (t4 natural join t5) where t5.z is not NULL;
|
||||
c b y z
|
||||
3 1 11 4
|
||||
3 2 11 4
|
||||
select * from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
c b a b y c
|
||||
3 1 2 1 2 3
|
||||
3 2 2 1 2 3
|
||||
select * from (t2 join t4 on b + 1 = y) join t1 on t1.c = t4.c;
|
||||
a b y c c b
|
||||
2 1 2 3 3 1
|
||||
2 1 2 3 3 2
|
||||
select * from t1 natural join (t2 join t4 on b + 1 = y);
|
||||
c b a y
|
||||
3 1 2 2
|
||||
select * from (t1 cross join t2) join (t3 cross join t4) on (a < y and t2.b < t3.c);
|
||||
c b a b b c y c
|
||||
10 1 2 1 1 3 11 3
|
||||
10 1 2 1 1 10 11 3
|
||||
3 1 2 1 1 3 11 3
|
||||
3 1 2 1 1 10 11 3
|
||||
3 2 2 1 1 3 11 3
|
||||
3 2 2 1 1 10 11 3
|
||||
select * from (t1, t2) join (t3, t4) on (a < y and t2.b < t3.c);
|
||||
c b a b b c y c
|
||||
10 1 2 1 1 3 11 3
|
||||
10 1 2 1 1 10 11 3
|
||||
3 1 2 1 1 3 11 3
|
||||
3 1 2 1 1 10 11 3
|
||||
3 2 2 1 1 3 11 3
|
||||
3 2 2 1 1 10 11 3
|
||||
select * from (t1 natural join t2) join (t3 natural join t4) on a = y;
|
||||
b c a c b y
|
||||
1 10 2 3 1 2
|
||||
1 3 2 3 1 2
|
||||
select * from ((t3 join (t1 join t2 on c > a) on t3.b < t2.a) join t4 on y > t1.c) join t5 on z = t1.b + 3;
|
||||
b c c b a b y c y z
|
||||
1 3 10 1 2 1 11 3 11 4
|
||||
1 10 10 1 2 1 11 3 11 4
|
||||
1 3 3 1 2 1 11 3 11 4
|
||||
1 10 3 1 2 1 11 3 11 4
|
||||
select * from t1 natural join t2 where t1.b > 0;
|
||||
b c a
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from t1 natural join (t4 natural join t5) where t4.y > 7;
|
||||
c b y z
|
||||
3 1 11 4
|
||||
3 2 11 4
|
||||
select * from (t4 natural join t5) natural join t1 where t4.y > 7;
|
||||
c y z b
|
||||
3 11 4 1
|
||||
3 11 4 2
|
||||
select * from t1 natural left join (t4 natural join t5) where t4.y > 7;
|
||||
c b y z
|
||||
3 1 11 4
|
||||
3 2 11 4
|
||||
select * from (t4 natural join t5) natural right join t1 where t4.y > 7;
|
||||
c b y z
|
||||
3 1 11 4
|
||||
3 2 11 4
|
||||
select * from (t1 natural join t2) join (t3 natural join t4) on t1.b = t3.b;
|
||||
b c a c b y
|
||||
1 10 2 3 1 11
|
||||
1 10 2 3 1 2
|
||||
1 3 2 3 1 11
|
||||
1 3 2 3 1 2
|
||||
select t1.*, t2.* from t1 natural join t2;
|
||||
c b a b
|
||||
10 1 2 1
|
||||
3 1 2 1
|
||||
select t1.*, t2.*, t3.*, t4.* from (t1 natural join t2) natural join (t3 natural join t4);
|
||||
c b a b b c y c
|
||||
3 1 2 1 1 3 11 3
|
||||
3 1 2 1 1 3 2 3
|
||||
select * from (select * from t1 natural join t2) as t12
|
||||
natural join
|
||||
(select * from t3 natural join t4) as t34;
|
||||
b c a y
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (select * from t1 natural join t2) as t12
|
||||
natural left join
|
||||
(select * from t3 natural join t4) as t34;
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from (select * from t3 natural join t4) as t34
|
||||
natural right join
|
||||
(select * from t1 natural join t2) as t12;
|
||||
b c a y
|
||||
1 10 2 NULL
|
||||
1 3 2 11
|
||||
1 3 2 2
|
||||
select * from v1a;
|
||||
b c a
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from v1b;
|
||||
a b c
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from v1c;
|
||||
a b c
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from v1d;
|
||||
b a c
|
||||
2 10 1
|
||||
2 3 1
|
||||
select * from v2a;
|
||||
c b a
|
||||
3 1 2
|
||||
3 2 2
|
||||
select * from v2b;
|
||||
b a c
|
||||
3 1 2
|
||||
3 2 2
|
||||
select * from v3a;
|
||||
b c a
|
||||
1 10 2
|
||||
1 3 2
|
||||
select * from v3b;
|
||||
c b a
|
||||
10 1 2
|
||||
3 1 2
|
||||
select * from v4;
|
||||
c b a
|
||||
3 1 2
|
||||
select * from v1a natural join v2a;
|
||||
b c a
|
||||
1 3 2
|
||||
select v2a.* from v1a natural join v2a;
|
||||
c b a
|
||||
3 1 2
|
||||
select * from v1b join v2a on v1b.b = v2a.c;
|
||||
a b c c b a
|
||||
1 3 2 3 1 2
|
||||
1 3 2 3 2 2
|
||||
select * from v1c join v2a on v1c.b = v2a.c;
|
||||
a b c c b a
|
||||
1 3 2 3 1 2
|
||||
1 3 2 3 2 2
|
||||
select * from v1d join v2a on v1d.a = v2a.c;
|
||||
b a c c b a
|
||||
2 3 1 3 1 2
|
||||
2 3 1 3 2 2
|
||||
select * from v1a join (t3 natural join t4) on a = y;
|
||||
b c a c b y
|
||||
1 10 2 3 1 2
|
||||
1 3 2 3 1 2
|
||||
select * from t1 natural join (t3 cross join t4);
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select * from (t3 cross join t4) natural join t1;
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select * from t1 join (t2, t3) using (b);
|
||||
ERROR 23000: Column 'b' in from clause is ambiguous
|
||||
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
|
||||
ERROR 23000: Column 'b' in from clause is ambiguous
|
||||
select * from (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
|
||||
ERROR 23000: Column 'b' in from clause is ambiguous
|
||||
select * from (t3 join (t4 natural join t5) on (b < z))
|
||||
natural join
|
||||
(t1 natural join t2);
|
||||
ERROR 23000: Column 'c' in from clause is ambiguous
|
||||
select t1.b from v1a;
|
||||
ERROR 42S22: Unknown column 't1.b' in 'field list'
|
||||
select * from v1a join v1b on t1.b = t2.b;
|
||||
ERROR 42S22: Unknown column 't1.b' in 'on clause'
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
drop table t6;
|
||||
drop view v1a;
|
||||
drop view v1b;
|
||||
drop view v1c;
|
||||
drop view v1d;
|
||||
drop view v2a;
|
||||
drop view v2b;
|
||||
drop view v3a;
|
||||
drop view v3b;
|
||||
drop view v4;
|
||||
|
@ -1466,4 +1466,4 @@ id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t4 ref a a 5 test.t3.b X
|
||||
1 SIMPLE t6 ref a a 5 test.t4.b X
|
||||
1 SIMPLE t5 ref a a 5 test.t3.b X
|
||||
drop table t0, t1, t2, t4, t5, t6;
|
||||
drop table t0, t1, t2, t3, t4, t5, t6, t7;
|
||||
|
@ -2550,3 +2550,72 @@ DELIMITER ;
|
||||
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1;
|
||||
create table t1 (a binary(1), b blob);
|
||||
insert into t1 values ('','');
|
||||
|
||||
/*!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 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!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` binary(1) default NULL,
|
||||
`b` blob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (0x00,'');
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!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 */;
|
||||
|
||||
|
||||
/*!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 */;
|
||||
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
|
||||
/*!40103 SET TIME_ZONE='+00:00' */;
|
||||
/*!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` binary(1) default NULL,
|
||||
`b` blob
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
|
||||
|
||||
|
||||
/*!40000 ALTER TABLE `t1` DISABLE KEYS */;
|
||||
LOCK TABLES `t1` WRITE;
|
||||
INSERT INTO `t1` VALUES (0x00,'');
|
||||
UNLOCK TABLES;
|
||||
/*!40000 ALTER TABLE `t1` ENABLE KEYS */;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
/*!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;
|
||||
|
@ -391,3 +391,25 @@ root@localhost
|
||||
--------------------------------------------------------------------------------
|
||||
this will be executed
|
||||
this will be executed
|
||||
mysqltest: At line 2: query 'create table t1 (a int primary key);
|
||||
insert into t1 values (1);
|
||||
select 'select-me';
|
||||
insertz 'error query'' failed: 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 'insertz 'error query'' at line 1
|
||||
drop table t1;
|
||||
drop table t1;
|
||||
create table t1 (a int primary key);
|
||||
insert into t1 values (1);
|
||||
select 'select-me';
|
||||
insertz error query||||
|
||||
select-me
|
||||
select-me
|
||||
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 'insertz error query' at line 1
|
||||
drop table t1;
|
||||
create table t1 (a int primary key);
|
||||
insert into t1 values (1);
|
||||
select 'select-me';
|
||||
insertz error query||||
|
||||
select-me
|
||||
select-me
|
||||
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 'insertz error query' at line 1
|
||||
drop table t1;
|
||||
|
@ -179,7 +179,7 @@ a b c
|
||||
2 two two
|
||||
alter table t1 drop index c;
|
||||
select * from t1 where b = 'two';
|
||||
ERROR HY000: Table definition has changed, please retry transaction
|
||||
ERROR HY000: Can't lock file (errno: 241)
|
||||
select * from t1 where b = 'two';
|
||||
a b c
|
||||
2 two two
|
||||
|
@ -667,13 +667,13 @@ counter datavalue
|
||||
57 newval
|
||||
58 newval
|
||||
drop table t1;
|
||||
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
|
||||
select * from t1;
|
||||
b
|
||||
drop table t1;
|
||||
create table atablewithareallylongandirritatingname (a int);
|
||||
insert into atablewithareallylongandirritatingname values (2);
|
||||
select * from atablewithareallylongandirritatingname;
|
||||
a
|
||||
2
|
||||
drop table atablewithareallylongandirritatingname;
|
||||
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
|
||||
select * from t1;
|
||||
b
|
||||
drop table t1;
|
||||
|
@ -337,7 +337,7 @@ set @precision=10000000000;
|
||||
select rand(),
|
||||
cast(rand(10)*@precision as unsigned integer) from t1;
|
||||
rand() cast(rand(10)*@precision as unsigned integer)
|
||||
- 6570515219
|
||||
- 6570515220
|
||||
- 1282061302
|
||||
- 6698761160
|
||||
- 9647622201
|
||||
@ -348,23 +348,23 @@ prepare stmt from
|
||||
set @var=1;
|
||||
execute stmt using @var;
|
||||
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
|
||||
- 6570515219 -
|
||||
- 6570515220 -
|
||||
- 1282061302 -
|
||||
- 6698761160 -
|
||||
- 9647622201 -
|
||||
set @var=2;
|
||||
execute stmt using @var;
|
||||
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
|
||||
- 6570515219 6555866465
|
||||
- 1282061302 1223466192
|
||||
- 6698761160 6449731873
|
||||
- 6570515220 6555866465
|
||||
- 1282061302 1223466193
|
||||
- 6698761160 6449731874
|
||||
- 9647622201 8578261098
|
||||
set @var=3;
|
||||
execute stmt using @var;
|
||||
rand() cast(rand(10)*@precision as unsigned integer) cast(rand(?)*@precision as unsigned integer)
|
||||
- 6570515219 9057697559
|
||||
- 6570515220 9057697560
|
||||
- 1282061302 3730790581
|
||||
- 6698761160 1480860534
|
||||
- 6698761160 1480860535
|
||||
- 9647622201 6211931236
|
||||
drop table t1;
|
||||
deallocate prepare stmt;
|
||||
@ -806,3 +806,29 @@ execute stmt;
|
||||
@@tx_isolation
|
||||
REPEATABLE-READ
|
||||
deallocate prepare stmt;
|
||||
prepare stmt from "create temporary table t1 (letter enum('','a','b','c')
|
||||
not null)";
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
prepare stmt from "create table t1 (a enum('test') default 'test')
|
||||
character set utf8";
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
set names default;
|
||||
deallocate prepare stmt;
|
||||
create table t1 (id int);
|
||||
prepare ins_call from "insert into t1 (id) values (1)";
|
||||
execute ins_call;
|
||||
select row_count();
|
||||
row_count()
|
||||
1
|
||||
drop table t1;
|
||||
|
@ -1022,6 +1022,31 @@ Variable_name Value
|
||||
Qcache_hits 1
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
flush status;
|
||||
(select a from t1) union (select a from t1);
|
||||
a
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
(select a from t1) union (select a from t1);
|
||||
a
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1),(2);
|
||||
CREATE PROCEDURE `p1`()
|
||||
begin
|
||||
|
@ -2708,6 +2708,14 @@ 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 (f1 int,f2 int);
|
||||
insert into t1 values(1,1);
|
||||
create table t2 (f3 int, f4 int, primary key(f3,f4));
|
||||
insert into t2 values(1,1);
|
||||
select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2));
|
||||
f1 f2
|
||||
1 1
|
||||
drop table t1,t2;
|
||||
CREATE TABLE t1 ( city char(30) );
|
||||
INSERT INTO t1 VALUES ('London');
|
||||
INSERT INTO t1 VALUES ('Paris');
|
||||
@ -3283,3 +3291,49 @@ f1 f2 x1
|
||||
30 1 30
|
||||
drop table t1;
|
||||
drop view v1, v2, v3;
|
||||
CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
|
||||
CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
|
||||
CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
|
||||
PRIMARY KEY(key_a,key_b));
|
||||
INSERT INTO t1 VALUES (0,'');
|
||||
INSERT INTO t1 VALUES (1,'i');
|
||||
INSERT INTO t1 VALUES (2,'j');
|
||||
INSERT INTO t1 VALUES (3,'k');
|
||||
INSERT INTO t2 VALUES (1,'r');
|
||||
INSERT INTO t2 VALUES (2,'s');
|
||||
INSERT INTO t2 VALUES (3,'t');
|
||||
INSERT INTO t3 VALUES (1,5,'x');
|
||||
INSERT INTO t3 VALUES (1,6,'y');
|
||||
INSERT INTO t3 VALUES (2,5,'xx');
|
||||
INSERT INTO t3 VALUES (2,6,'yy');
|
||||
INSERT INTO t3 VALUES (2,7,'zz');
|
||||
INSERT INTO t3 VALUES (3,5,'xxx');
|
||||
SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
key_a foo
|
||||
2 xx
|
||||
EXPLAIN SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
|
||||
SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
key_a foo
|
||||
2 xx
|
||||
EXPLAIN SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t2 const PRIMARY PRIMARY 4 const 1 Using index
|
||||
1 SIMPLE t3 const PRIMARY PRIMARY 8 const,const 1
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
@ -988,6 +988,10 @@ end|
|
||||
select f5(1)|
|
||||
f5(1)
|
||||
1
|
||||
select f5(2)|
|
||||
ERROR HY000: Recursive stored functions and triggers are not allowed.
|
||||
select f5(3)|
|
||||
ERROR HY000: Recursive stored functions and triggers are not allowed.
|
||||
create function f6() returns int
|
||||
begin
|
||||
declare n int;
|
||||
@ -1035,6 +1039,12 @@ select * from v1|
|
||||
ERROR HY000: View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
|
||||
create function f1() returns int
|
||||
return (select sum(data) from t1) + (select sum(data) from v1)|
|
||||
select f1()|
|
||||
ERROR HY000: Recursive stored functions and triggers are not allowed.
|
||||
select * from v1|
|
||||
ERROR HY000: Recursive stored functions and triggers are not allowed.
|
||||
select * from v2|
|
||||
ERROR HY000: Recursive stored functions and triggers are not allowed.
|
||||
drop function f1|
|
||||
create function f1() returns int
|
||||
return (select sum(data) from t1)|
|
||||
@ -1053,7 +1063,7 @@ f0()
|
||||
select *, f0() from v0|
|
||||
f0() f0()
|
||||
100 100
|
||||
lock tables t1 read, t1 as t11 read, mysql.proc read|
|
||||
lock tables t1 read, t1 as t11 read|
|
||||
select f3()|
|
||||
f3()
|
||||
1
|
||||
@ -1251,6 +1261,62 @@ drop procedure opp|
|
||||
drop procedure ip|
|
||||
show procedure status like '%p%'|
|
||||
Db Name Type Definer Modified Created Security_type Comment
|
||||
drop table if exists fib|
|
||||
create table fib ( f bigint unsigned not null )|
|
||||
drop procedure if exists fib|
|
||||
create procedure fib(n int unsigned)
|
||||
begin
|
||||
if n > 1 then
|
||||
begin
|
||||
declare x, y bigint unsigned;
|
||||
declare c cursor for select f from fib order by f desc limit 2;
|
||||
open c;
|
||||
fetch c into y;
|
||||
fetch c into x;
|
||||
close c;
|
||||
insert into fib values (x+y);
|
||||
call fib(n-1);
|
||||
end;
|
||||
end if;
|
||||
end|
|
||||
set @@max_sp_recursion_depth= 20|
|
||||
insert into fib values (0), (1)|
|
||||
call fib(3)|
|
||||
select * from fib order by f asc|
|
||||
f
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
delete from fib|
|
||||
insert into fib values (0), (1)|
|
||||
call fib(20)|
|
||||
select * from fib order by f asc|
|
||||
f
|
||||
0
|
||||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
5
|
||||
8
|
||||
13
|
||||
21
|
||||
34
|
||||
55
|
||||
89
|
||||
144
|
||||
233
|
||||
377
|
||||
610
|
||||
987
|
||||
1597
|
||||
2584
|
||||
4181
|
||||
6765
|
||||
drop table fib|
|
||||
drop procedure fib|
|
||||
set @@max_sp_recursion_depth= 0|
|
||||
drop procedure if exists bar|
|
||||
create procedure bar(x char(16), y int)
|
||||
comment "111111111111" sql security invoker
|
||||
@ -1479,6 +1545,52 @@ select @x2|
|
||||
@x2
|
||||
2
|
||||
drop procedure bug2260|
|
||||
drop procedure if exists bug2267_1|
|
||||
create procedure bug2267_1()
|
||||
begin
|
||||
show procedure status;
|
||||
end|
|
||||
drop procedure if exists bug2267_2|
|
||||
create procedure bug2267_2()
|
||||
begin
|
||||
show function status;
|
||||
end|
|
||||
drop procedure if exists bug2267_3|
|
||||
create procedure bug2267_3()
|
||||
begin
|
||||
show create procedure bug2267_1;
|
||||
end|
|
||||
drop procedure if exists bug2267_4|
|
||||
drop function if exists bug2267_4|
|
||||
create procedure bug2267_4()
|
||||
begin
|
||||
show create function bug2267_4;
|
||||
end|
|
||||
create function bug2267_4() returns int return 100|
|
||||
call bug2267_1()|
|
||||
Db Name Type Definer Modified Created Security_type Comment
|
||||
test bug2267_1 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
test bug2267_2 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
test bug2267_3 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
test bug2267_4 PROCEDURE root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
call bug2267_2()|
|
||||
Db Name Type Definer Modified Created Security_type Comment
|
||||
test bug2267_4 FUNCTION root@localhost 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER
|
||||
call bug2267_3()|
|
||||
Procedure sql_mode Create Procedure
|
||||
bug2267_1 CREATE PROCEDURE `bug2267_1`()
|
||||
begin
|
||||
show procedure status;
|
||||
end
|
||||
call bug2267_4()|
|
||||
Function sql_mode Create Function
|
||||
bug2267_4 CREATE FUNCTION `bug2267_4`() RETURNS int(11)
|
||||
return 100
|
||||
drop procedure bug2267_1|
|
||||
drop procedure bug2267_2|
|
||||
drop procedure bug2267_3|
|
||||
drop procedure bug2267_4|
|
||||
drop function bug2267_4|
|
||||
drop procedure if exists bug2227|
|
||||
create procedure bug2227(x int)
|
||||
begin
|
||||
@ -1490,6 +1602,18 @@ call bug2227(9)|
|
||||
1.3 x y 42 z
|
||||
1.3 9 2.6 42 zzz
|
||||
drop procedure bug2227|
|
||||
drop procedure if exists bug2614|
|
||||
create procedure bug2614()
|
||||
begin
|
||||
drop table if exists t3;
|
||||
create table t3 (id int default '0' not null);
|
||||
insert into t3 select 12;
|
||||
insert into t3 select * from t3;
|
||||
end|
|
||||
call bug2614()|
|
||||
call bug2614()|
|
||||
drop table t3|
|
||||
drop procedure bug2614|
|
||||
drop function if exists bug2674|
|
||||
create function bug2674() returns int
|
||||
return @@sort_buffer_size|
|
||||
@ -3868,5 +3992,165 @@ drop procedure bug10100pv|
|
||||
drop procedure bug10100pd|
|
||||
drop procedure bug10100pc|
|
||||
drop view v1|
|
||||
drop procedure if exists bug13729|
|
||||
drop table if exists t3|
|
||||
create table t3 (s1 int, primary key (s1))|
|
||||
insert into t3 values (1),(2)|
|
||||
create procedure bug13729()
|
||||
begin
|
||||
declare continue handler for sqlexception select 55;
|
||||
update t3 set s1 = 1;
|
||||
end|
|
||||
call bug13729()|
|
||||
55
|
||||
55
|
||||
select * from t3|
|
||||
s1
|
||||
1
|
||||
2
|
||||
drop procedure bug13729|
|
||||
drop table t3|
|
||||
drop procedure if exists bug14643_1|
|
||||
drop procedure if exists bug14643_2|
|
||||
create procedure bug14643_1()
|
||||
begin
|
||||
declare continue handler for sqlexception select 'boo' as 'Handler';
|
||||
begin
|
||||
declare v int default x;
|
||||
if v = 1 then
|
||||
select 1;
|
||||
else
|
||||
select 2;
|
||||
end if;
|
||||
end;
|
||||
end|
|
||||
create procedure bug14643_2()
|
||||
begin
|
||||
declare continue handler for sqlexception select 'boo' as 'Handler';
|
||||
case x
|
||||
when 1 then
|
||||
select 1;
|
||||
else
|
||||
select 2;
|
||||
end case;
|
||||
end|
|
||||
call bug14643_1()|
|
||||
Handler
|
||||
boo
|
||||
2
|
||||
2
|
||||
call bug14643_2()|
|
||||
Handler
|
||||
boo
|
||||
2
|
||||
2
|
||||
drop procedure bug14643_1|
|
||||
drop procedure bug14643_2|
|
||||
drop procedure if exists bug14304|
|
||||
drop table if exists t3, t4|
|
||||
create table t3(a int primary key auto_increment)|
|
||||
create table t4(a int primary key auto_increment)|
|
||||
create procedure bug14304()
|
||||
begin
|
||||
insert into t3 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 select null as a;
|
||||
insert into t3 set a=null;
|
||||
insert into t3 set a=null;
|
||||
select * from t3;
|
||||
end|
|
||||
call bug14304()|
|
||||
a
|
||||
1
|
||||
2
|
||||
3
|
||||
drop procedure bug14304|
|
||||
drop table t3, t4|
|
||||
drop procedure if exists bug14376|
|
||||
create procedure bug14376()
|
||||
begin
|
||||
declare x int default x;
|
||||
end|
|
||||
call bug14376()|
|
||||
ERROR 42S22: Unknown column 'x' in 'field list'
|
||||
drop procedure bug14376|
|
||||
create procedure bug14376()
|
||||
begin
|
||||
declare x int default 42;
|
||||
begin
|
||||
declare x int default x;
|
||||
select x;
|
||||
end;
|
||||
end|
|
||||
call bug14376()|
|
||||
x
|
||||
42
|
||||
drop procedure bug14376|
|
||||
create procedure bug14376(x int)
|
||||
begin
|
||||
declare x int default x;
|
||||
select x;
|
||||
end|
|
||||
call bug14376(4711)|
|
||||
x
|
||||
4711
|
||||
drop procedure bug14376|
|
||||
drop procedure if exists p1|
|
||||
Warnings:
|
||||
Note 1305 PROCEDURE p1 does not exist
|
||||
drop table if exists t1|
|
||||
create table t1 (a varchar(255))|
|
||||
insert into t1 (a) values ("a - table column")|
|
||||
create procedure p1(a varchar(255))
|
||||
begin
|
||||
declare i varchar(255);
|
||||
declare c cursor for select a from t1;
|
||||
select a;
|
||||
select a from t1 into i;
|
||||
select i as 'Parameter takes precedence over table column'; open c;
|
||||
fetch c into i;
|
||||
close c;
|
||||
select i as 'Parameter takes precedence over table column in cursors';
|
||||
begin
|
||||
declare a varchar(255) default 'a - local variable';
|
||||
declare c1 cursor for select a from t1;
|
||||
select a as 'A local variable takes precedence over parameter';
|
||||
open c1;
|
||||
fetch c1 into i;
|
||||
close c1;
|
||||
select i as 'A local variable takes precedence over parameter in cursors';
|
||||
begin
|
||||
declare a varchar(255) default 'a - local variable in a nested compound statement';
|
||||
declare c2 cursor for select a from t1;
|
||||
select a as 'A local variable in a nested compound statement takes precedence over a local variable in the outer statement';
|
||||
select a from t1 into i;
|
||||
select i as 'A local variable in a nested compound statement takes precedence over table column';
|
||||
open c2;
|
||||
fetch c2 into i;
|
||||
close c2;
|
||||
select i as 'A local variable in a nested compound statement takes precedence over table column in cursors';
|
||||
end;
|
||||
end;
|
||||
end|
|
||||
call p1("a - stored procedure parameter")|
|
||||
a
|
||||
a - stored procedure parameter
|
||||
Parameter takes precedence over table column
|
||||
a - stored procedure parameter
|
||||
Parameter takes precedence over table column in cursors
|
||||
a - stored procedure parameter
|
||||
A local variable takes precedence over parameter
|
||||
a - local variable
|
||||
A local variable takes precedence over parameter in cursors
|
||||
a - local variable
|
||||
A local variable in a nested compound statement takes precedence over a local variable in the outer statement
|
||||
a - local variable in a nested compound statement
|
||||
A local variable in a nested compound statement takes precedence over table column
|
||||
a - local variable in a nested compound statement
|
||||
A local variable in a nested compound statement takes precedence over table column in cursors
|
||||
a - local variable in a nested compound statement
|
||||
drop table t1,t2;
|
||||
|
@ -369,3 +369,59 @@ drop procedure bug13825_0|
|
||||
drop procedure bug13825_1|
|
||||
drop procedure bug13825_2|
|
||||
drop table t1, t2|
|
||||
drop table if exists t3|
|
||||
drop procedure if exists bug14840_1|
|
||||
drop procedure if exists bug14840_2|
|
||||
create table t3
|
||||
(
|
||||
x int,
|
||||
y int,
|
||||
primary key (x)
|
||||
) engine=InnoDB|
|
||||
create procedure bug14840_1()
|
||||
begin
|
||||
declare err int default 0;
|
||||
declare continue handler for sqlexception
|
||||
set err = err + 1;
|
||||
start transaction;
|
||||
update t3 set x = 1, y = 42 where x = 2;
|
||||
insert into t3 values (3, 4711);
|
||||
if err > 0 then
|
||||
rollback;
|
||||
else
|
||||
commit;
|
||||
end if;
|
||||
select * from t3;
|
||||
end|
|
||||
create procedure bug14840_2()
|
||||
begin
|
||||
declare err int default 0;
|
||||
declare continue handler for sqlexception
|
||||
begin
|
||||
set err = err + 1;
|
||||
select err as 'Ping';
|
||||
end;
|
||||
update t3 set x = 1, y = 42 where x = 2;
|
||||
update t3 set x = 1, y = 42 where x = 2;
|
||||
insert into t3 values (3, 4711);
|
||||
select * from t3;
|
||||
end|
|
||||
insert into t3 values (1, 3), (2, 5)|
|
||||
call bug14840_1()|
|
||||
x y
|
||||
1 3
|
||||
2 5
|
||||
delete from t3|
|
||||
insert into t3 values (1, 3), (2, 5)|
|
||||
call bug14840_2()|
|
||||
Ping
|
||||
1
|
||||
Ping
|
||||
2
|
||||
x y
|
||||
1 3
|
||||
2 5
|
||||
3 4711
|
||||
drop procedure bug14840_1|
|
||||
drop procedure bug14840_2|
|
||||
drop table t3|
|
||||
|
11
mysql-test/r/type_newdecimal-big.result
Normal file
11
mysql-test/r/type_newdecimal-big.result
Normal file
@ -0,0 +1,11 @@
|
||||
drop procedure if exists sp1;
|
||||
create procedure sp1 () begin
|
||||
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
|
||||
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
|
||||
while v5 < 100000 do
|
||||
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
|
||||
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
|
||||
call sp1()//
|
||||
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001
|
||||
1.000000100000 1.999999900000 1.000000100000 1.999999900000
|
||||
drop procedure sp1;
|
@ -678,16 +678,6 @@ select -18.3=18.3;
|
||||
select 0.8 = 0.7 + 0.1;
|
||||
0.8 = 0.7 + 0.1
|
||||
1
|
||||
create procedure p1 () begin
|
||||
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
|
||||
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
|
||||
while v5 < 100000 do
|
||||
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
|
||||
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
|
||||
call p1()//
|
||||
v1 v2 v3 * 0.000000000001 v4 * 0.000000000001
|
||||
1.000000100000 1.999999900000 1.000000100000 1.999999900000
|
||||
drop procedure p1;
|
||||
drop table if exists t1;
|
||||
Warnings:
|
||||
Note 1051 Unknown table 't1'
|
||||
@ -1267,34 +1257,6 @@ CAST(my_varchar AS DECIMAL(65,30)) my_varchar
|
||||
0.011754943450000000000000000000 1.175494345e-2
|
||||
0.117549434500000000000000000000 1.175494345e-1
|
||||
UPDATE t1 SET my_decimal = my_float;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 1
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 2
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 3
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 4
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 5
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 6
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 7
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 8
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 9
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 10
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 11
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 12
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 13
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 14
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 15
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 16
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 17
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 19
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 20
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 21
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 22
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 23
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 26
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 27
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 30
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 31
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 32
|
||||
SELECT my_decimal, my_float FROM t1;
|
||||
my_decimal my_float
|
||||
0.000000000000000000000000000000 1.17549e-32
|
||||
@ -1330,24 +1292,6 @@ my_decimal my_float
|
||||
0.011754943057894710000000000000 0.0117549
|
||||
0.117549434304237400000000000000 0.117549
|
||||
UPDATE t1 SET my_decimal = my_double;
|
||||
Warnings:
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 1
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 2
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 3
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 4
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 5
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 6
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 7
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 8
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 9
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 10
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 11
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 13
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 14
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 16
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 18
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 20
|
||||
Note 1265 Data truncated for column 'my_decimal' at row 31
|
||||
SELECT my_decimal, my_double FROM t1;
|
||||
my_decimal my_double
|
||||
0.000000000000000000000000000000 1.175494345e-32
|
||||
|
@ -215,7 +215,7 @@ Field Type Collation Null Key Default Extra Privileges Comment
|
||||
auto int(5) unsigned NULL NO MUL NULL auto_increment #
|
||||
string char(10) latin1_swedish_ci YES newdefault #
|
||||
tiny tinyint(4) NULL NO MUL 0 #
|
||||
short smallint(6) NULL NO MUL 0 #
|
||||
short smallint(6) NULL NO MUL #
|
||||
medium mediumint(8) NULL NO MUL 0 #
|
||||
long_int int(11) NULL NO 0 #
|
||||
longlong bigint(13) NULL NO MUL 0 #
|
||||
|
@ -1220,6 +1220,32 @@ show columns from t2;
|
||||
Field Type Null Key Default Extra
|
||||
a varchar(3) YES NULL
|
||||
drop table t2, t1;
|
||||
create table t1 (f1 decimal(60,25), f2 decimal(60,25));
|
||||
insert into t1 values (0.0,0.0);
|
||||
select f1 from t1 union all select f2 from t1;
|
||||
f1
|
||||
0.0000000000000000000000000
|
||||
0.0000000000000000000000000
|
||||
select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
|
||||
union all
|
||||
select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
|
||||
description f1
|
||||
XXXXXXXXXXXXXXXXXXXX 0.0000000000000000000000000
|
||||
YYYYYYYYYYYYYYYYYYYY 0.0000000000000000000000000
|
||||
drop table t1;
|
||||
create table t1 (f1 decimal(60,24), f2 decimal(60,24));
|
||||
insert into t1 values (0.0,0.0);
|
||||
select f1 from t1 union all select f2 from t1;
|
||||
f1
|
||||
0.000000000000000000000000
|
||||
0.000000000000000000000000
|
||||
select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
|
||||
union all
|
||||
select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
|
||||
description f1
|
||||
XXXXXXXXXXXXXXXXXXXX 0.000000000000000000000000
|
||||
YYYYYYYYYYYYYYYYYYYY 0.000000000000000000000000
|
||||
drop table t1;
|
||||
create table t1 (a varchar(5));
|
||||
create table t2 select * from t1 union select 'abcdefghijkl';
|
||||
show create table t2;
|
||||
|
@ -345,3 +345,16 @@ f1
|
||||
2000-01-01
|
||||
2002-02-02
|
||||
drop table t1;
|
||||
create table t1 (f1 int);
|
||||
create table t2 (f2 int);
|
||||
insert into t1 values(1),(2);
|
||||
insert into t2 values(1),(1);
|
||||
update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
|
||||
affected rows: 3
|
||||
info: Rows matched: 3 Changed: 3 Warnings: 0
|
||||
update t2 set f2=1;
|
||||
update t1 set f1=1 where f1=3;
|
||||
update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
|
||||
affected rows: 3
|
||||
info: Rows matched: 3 Changed: 3 Warnings: 0
|
||||
drop table t1,t2;
|
||||
|
@ -2424,3 +2424,30 @@ f1 sum(f2)
|
||||
NULL 12
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
drop procedure if exists p1;
|
||||
create procedure p1 () deterministic
|
||||
begin
|
||||
create view v1 as select 1;
|
||||
end;
|
||||
//
|
||||
call p1();
|
||||
show create view v1;
|
||||
View Create View
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select 1 AS `1`
|
||||
drop view v1;
|
||||
drop procedure p1;
|
||||
CREATE VIEW v1 AS SELECT 42 AS Meaning;
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
CREATE FUNCTION f1() RETURNS INTEGER
|
||||
BEGIN
|
||||
DECLARE retn INTEGER;
|
||||
SELECT Meaning FROM v1 INTO retn;
|
||||
RETURN retn;
|
||||
END
|
||||
//
|
||||
CREATE VIEW v2 AS SELECT f1();
|
||||
select * from v2;
|
||||
f1()
|
||||
42
|
||||
drop view v2,v1;
|
||||
drop function f1;
|
||||
|
@ -132,4 +132,65 @@ unlock tables;
|
||||
set query_cache_wlock_invalidate=default;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
flush status;
|
||||
create table t1 (a int, b int);
|
||||
create algorithm=temptable view v1 as select * from t1;
|
||||
select * from v1;
|
||||
a b
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 0
|
||||
select * from v1;
|
||||
a b
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
insert into t1 values (1,1);
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 1
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 1
|
||||
select * from v1;
|
||||
a b
|
||||
1 1
|
||||
select * from v1;
|
||||
a b
|
||||
1 1
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 1
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
drop view v1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
Variable_name Value
|
||||
Qcache_queries_in_cache 0
|
||||
show status like "Qcache_inserts";
|
||||
Variable_name Value
|
||||
Qcache_inserts 2
|
||||
show status like "Qcache_hits";
|
||||
Variable_name Value
|
||||
Qcache_hits 2
|
||||
drop table t1;
|
||||
set GLOBAL query_cache_size=default;
|
||||
|
@ -401,3 +401,12 @@ use test;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #14693 (ALTER SET DEFAULT doesn't work)
|
||||
#
|
||||
|
||||
create table t1 (mycol int(10) not null);
|
||||
alter table t1 alter column mycol set default 0;
|
||||
desc t1;
|
||||
drop table t1;
|
||||
|
@ -39,6 +39,20 @@ check table t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
# Bug #14902 ANALYZE TABLE fails to recognize up-to-date tables
|
||||
# minimal test case to get an error.
|
||||
# The problem is happening when analysing table with FT index that
|
||||
# contains stopwords only. The first execution of analyze table should
|
||||
# mark index statistics as up to date so that next execution of this
|
||||
# statement will end up with Table is up to date status.
|
||||
create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_general_ci engine myisam;
|
||||
insert into t1 values ('hello');
|
||||
|
||||
analyze table t1;
|
||||
analyze table t1;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# procedure in PS BUG#13673
|
||||
#
|
||||
|
@ -974,3 +974,22 @@ drop table t1;
|
||||
|
||||
# End varchar test
|
||||
eval set storage_engine=$default;
|
||||
|
||||
#
|
||||
# Test that we can create a large key
|
||||
#
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
key (a,b,c,d)) engine=bdb;
|
||||
drop table t1;
|
||||
--error ER_TOO_LONG_KEY
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
e varchar(255) character set utf8,
|
||||
key (a,b,c,d,e)) engine=bdb;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -17,7 +17,7 @@ while ($1)
|
||||
SET @rnd= RAND();
|
||||
SET @id = CAST(@rnd * @rnd_max AS UNSIGNED);
|
||||
SET @id_rev= @rnd_max - @id;
|
||||
SET @grp= CAST(128.0 * @rnd AS UNSIGNED);
|
||||
SET @grp= CAST(127.0 * @rnd AS UNSIGNED);
|
||||
INSERT INTO t1 (id, grp, id_rev) VALUES (@id, @grp, @id_rev);
|
||||
dec $1;
|
||||
}
|
||||
|
@ -631,3 +631,17 @@ show create table t2;
|
||||
drop table t1, t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #14155: Maximum value of MAX_ROWS handled incorrectly on 64-bit
|
||||
# platforms
|
||||
#
|
||||
create table t1 (i int) engine=myisam max_rows=100000000000;
|
||||
show create table t1;
|
||||
alter table t1 max_rows=100;
|
||||
show create table t1;
|
||||
alter table t1 max_rows=100000000000;
|
||||
show create table t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -144,8 +144,7 @@ create table t1 (a char(10) character set cp1251);
|
||||
insert into t1 values (_koi8r'<27><><EFBFBD><EFBFBD>');
|
||||
# this is possible:
|
||||
select * from t1 where a=_koi8r'<27><><EFBFBD><EFBFBD>';
|
||||
# this is not possible, because we have a function, not just a constant:
|
||||
--error 1267
|
||||
# this is possible, because we have a function with constant arguments:
|
||||
select * from t1 where a=concat(_koi8r'<27><><EFBFBD><EFBFBD>');
|
||||
# this is not posible, cannot convert _latin1'<27><><EFBFBD><EFBFBD>' into cp1251:
|
||||
--error 1267
|
||||
@ -153,6 +152,14 @@ select * from t1 where a=_latin1'
|
||||
drop table t1;
|
||||
set names latin1;
|
||||
|
||||
#
|
||||
# Bug#10446 Illegal mix of collations
|
||||
#
|
||||
create table t1 (a char(10) character set utf8 collate utf8_bin);
|
||||
insert into t1 values (' xxx');
|
||||
select * from t1 where a=lpad('xxx',10,' ');
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Check more automatic conversion
|
||||
#
|
||||
|
@ -884,7 +884,9 @@ SELECT DISTINCT id FROM t1 ORDER BY id;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bugs#10504: Character set does not support traditional mode
|
||||
# Bug#10504: Character set does not support traditional mode
|
||||
# Bug#14146: CHAR(...USING ...) and CONVERT(CHAR(...) USING...)
|
||||
# produce different results
|
||||
#
|
||||
set names utf8;
|
||||
# correct value
|
||||
@ -894,12 +896,14 @@ select char(0xd18f using utf8);
|
||||
select char(53647 using utf8);
|
||||
# incorrect value: return with warning
|
||||
select char(0xff,0x8f using utf8);
|
||||
select convert(char(0xff,0x8f) using utf8);
|
||||
# incorrect value in strict mode: return NULL with "Error" level warning
|
||||
set sql_mode=traditional;
|
||||
select char(0xff,0x8f using utf8);
|
||||
select char(195 using utf8);
|
||||
select char(196 using utf8);
|
||||
select char(2557 using utf8);
|
||||
select convert(char(0xff,0x8f) using utf8);
|
||||
|
||||
#
|
||||
# Check convert + char + using
|
||||
|
@ -354,6 +354,7 @@ SET myisam_repair_threads=@@global.myisam_repair_threads;
|
||||
#
|
||||
INSERT INTO t1 VALUES('testword\'\'');
|
||||
SELECT a FROM t1 WHERE MATCH a AGAINST('testword' IN BOOLEAN MODE);
|
||||
SELECT a FROM t1 WHERE MATCH a AGAINST('testword\'\'' IN BOOLEAN MODE);
|
||||
DROP TABLE t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -34,4 +34,13 @@ select * from t1 where value <=> value;
|
||||
select * from t1 where id <=> value or value<=>id;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug #12612: quoted bigint unsigned value and the use of "in" in where clause
|
||||
#
|
||||
create table t1 (a bigint unsigned);
|
||||
insert into t1 values (4828532208463511553);
|
||||
select * from t1 where a = '4828532208463511553';
|
||||
select * from t1 where a in ('4828532208463511553');
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -487,4 +487,16 @@ flush privileges;
|
||||
set @user123="non-existent";
|
||||
select * from mysql.db where user=@user123;
|
||||
|
||||
set names koi8r;
|
||||
create database <20><>;
|
||||
grant select on <20><>.* to root@localhost;
|
||||
select hex(Db) from mysql.db where Db='<27><>';
|
||||
show grants for root@localhost;
|
||||
flush privileges;
|
||||
show grants for root@localhost;
|
||||
drop database <20><>;
|
||||
revoke all privileges on <20><>.* from root@localhost;
|
||||
show grants for root@localhost;
|
||||
set names latin1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -693,3 +693,25 @@ create table t1(a int, key(a)) engine=innodb;
|
||||
insert into t1 values(1);
|
||||
select a, count(a) from t1 group by a with rollup;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #13293 Wrongly used index results in endless loop.
|
||||
#
|
||||
create table t1 (f1 int, f2 char(1), primary key(f1,f2)) engine=innodb;
|
||||
insert into t1 values ( 1,"e"),(2,"a"),( 3,"c"),(4,"d");
|
||||
alter table t1 drop primary key, add primary key (f2, f1);
|
||||
explain select distinct f1 a, f1 b from t1;
|
||||
explain select distinct f1, f2 from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug #14920 Ordering aggregated result sets with composite primary keys
|
||||
# corrupts resultset
|
||||
#
|
||||
create table t1 (c1 int not null,c2 int not null, primary key(c1,c2));
|
||||
insert into t1 (c1,c2) values
|
||||
(10,1),(10,2),(10,3),(20,4),(20,5),(20,6),(30,7),(30,8),(30,9);
|
||||
select distinct c1, c2 from t1 order by c2;
|
||||
select c1,min(c2) as c2 from t1 group by c1 order by c2;
|
||||
select c1,c2 from t1 group by c1,c2 order by c2;
|
||||
drop table t1;
|
||||
|
@ -738,3 +738,13 @@ create table t1(a blob, b text charset utf8, c text charset ucs2);
|
||||
select data_type, character_octet_length, character_maximum_length
|
||||
from information_schema.columns where table_name='t1';
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#14476 `information_schema`.`TABLES`.`TABLE_TYPE` with empty value
|
||||
#
|
||||
create table t1 (f1 int(11));
|
||||
create view v1 as select * from t1;
|
||||
drop table t1;
|
||||
select table_type from information_schema.tables
|
||||
where table_name="v1";
|
||||
drop view v1;
|
||||
|
@ -1751,3 +1751,22 @@ insert into t2 values (4,_ucs2 0x05612020,_ucs2 0x05612020,'taken');
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
commit;
|
||||
|
||||
#
|
||||
# Test that we can create a large (>1K) key
|
||||
#
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
key (a,b,c,d)) engine=innodb;
|
||||
drop table t1;
|
||||
--error ER_TOO_LONG_KEY
|
||||
create table t1 (a varchar(255) character set utf8,
|
||||
b varchar(255) character set utf8,
|
||||
c varchar(255) character set utf8,
|
||||
d varchar(255) character set utf8,
|
||||
e varchar(255) character set utf8,
|
||||
key (a,b,c,d,e)) engine=innodb;
|
||||
|
||||
--echo End of 5.0 tests
|
||||
|
@ -334,3 +334,210 @@ select t1.i,t2.i,t3.i from t2 right join t3 on (t2.i=t3.i),t1 order by t1.i,t2.i
|
||||
drop table t1,t2,t3;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Tests for WL#2486 Natural/using join according to SQL:2003.
|
||||
#
|
||||
# NOTICE:
|
||||
# - The tests are designed so that all statements, except MySQL
|
||||
# extensions run on any SQL server. Please do no change.
|
||||
# - Tests marked with TODO will be submitted as bugs.
|
||||
#
|
||||
|
||||
create table t1 (c int, b int);
|
||||
create table t2 (a int, b int);
|
||||
create table t3 (b int, c int);
|
||||
create table t4 (y int, c int);
|
||||
create table t5 (y int, z int);
|
||||
create table t6 (a int, c int);
|
||||
|
||||
insert into t1 values (10,1);
|
||||
insert into t1 values (3 ,1);
|
||||
insert into t1 values (3 ,2);
|
||||
insert into t2 values (2, 1);
|
||||
insert into t3 values (1, 3);
|
||||
insert into t3 values (1,10);
|
||||
insert into t4 values (11,3);
|
||||
insert into t4 values (2, 3);
|
||||
insert into t5 values (11,4);
|
||||
insert into t6 values (2, 3);
|
||||
|
||||
-- Views with simple natural join.
|
||||
create algorithm=merge view v1a as
|
||||
select * from t1 natural join t2;
|
||||
-- as above, but column names are cross-renamed: a->c, c->b, b->a
|
||||
create algorithm=merge view v1b(a,b,c) as
|
||||
select * from t1 natural join t2;
|
||||
-- as above, but column names are aliased: a->c, c->b, b->a
|
||||
create algorithm=merge view v1c as
|
||||
select b as a, c as b, a as c from t1 natural join t2;
|
||||
-- as above, but column names are cross-renamed, and aliased
|
||||
-- a->c->b, c->b->a, b->a->c
|
||||
create algorithm=merge view v1d(b, a, c) as
|
||||
select a as c, c as b, b as a from t1 natural join t2;
|
||||
|
||||
-- Views with JOIN ... ON
|
||||
create algorithm=merge view v2a as
|
||||
select t1.c, t1.b, t2.a from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
create algorithm=merge view v2b as
|
||||
select t1.c as b, t1.b as a, t2.a as c
|
||||
from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
|
||||
-- Views with bigger natural join
|
||||
create algorithm=merge view v3a as
|
||||
select * from t1 natural join t2 natural join t3;
|
||||
create algorithm=merge view v3b as
|
||||
select * from t1 natural join (t2 natural join t3);
|
||||
|
||||
-- View over views with mixed natural join and join ... on
|
||||
create algorithm=merge view v4 as
|
||||
select * from v2a natural join v3a;
|
||||
|
||||
-- Nested natural/using joins.
|
||||
select * from (t1 natural join t2) natural join (t3 natural join t4);
|
||||
select * from (t1 natural join t2) natural left join (t3 natural join t4);
|
||||
select * from (t3 natural join t4) natural right join (t1 natural join t2);
|
||||
select * from (t1 natural left join t2) natural left join (t3 natural left join t4);
|
||||
select * from (t4 natural right join t3) natural right join (t2 natural right join t1);
|
||||
select * from t1 natural join t2 natural join t3 natural join t4;
|
||||
select * from ((t1 natural join t2) natural join t3) natural join t4;
|
||||
select * from t1 natural join (t2 natural join (t3 natural join t4));
|
||||
-- BUG#15355: this query fails in 'prepared statements' mode
|
||||
-- select * from ((t3 natural join (t1 natural join t2)) natural join t4) natural join t5;
|
||||
-- select * from ((t3 natural left join (t1 natural left join t2)) natural left join t4) natural left join t5;
|
||||
select * from t5 natural right join (t4 natural right join ((t2 natural right join t1) natural right join t3));
|
||||
select * from (t1 natural join t2), (t3 natural join t4);
|
||||
-- MySQL extension - nested comma ',' operator instead of cross join.
|
||||
-- BUG#15357 - natural join with nested cross-join results in incorrect columns
|
||||
-- select * from t5 natural join ((t1 natural join t2), (t3 natural join t4));
|
||||
-- select * from ((t1 natural join t2), (t3 natural join t4)) natural join t5;
|
||||
-- select * from t5 natural join ((t1 natural join t2) cross join (t3 natural join t4));
|
||||
-- select * from ((t1 natural join t2) cross join (t3 natural join t4)) natural join t5;
|
||||
|
||||
select * from (t1 join t2 using (b)) join (t3 join t4 using (c)) using (c);
|
||||
select * from (t1 join t2 using (b)) natural join (t3 join t4 using (c));
|
||||
|
||||
|
||||
-- Other clauses refer to NJ columns.
|
||||
select a,b,c from (t1 natural join t2) natural join (t3 natural join t4)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a having min(b) < max(y) order by a;
|
||||
select * from (t1 natural join t2) natural left join (t3 natural join t4)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
|
||||
select * from (t3 natural join t4) natural right join (t1 natural join t2)
|
||||
where b + 1 = y or b + 10 = y group by b,c,a,y having min(b) < max(y) order by a, y;
|
||||
|
||||
-- Qualified column references to NJ columns.
|
||||
select * from t1 natural join t2 where t1.c > t2.a;
|
||||
select * from t1 natural join t2 where t1.b > t2.b;
|
||||
select * from t1 natural left join (t4 natural join t5) where t5.z is not NULL;
|
||||
|
||||
-- Nested 'join ... on' - name resolution of ON conditions
|
||||
select * from t1 join (t2 join t4 on b + 1 = y) on t1.c = t4.c;
|
||||
select * from (t2 join t4 on b + 1 = y) join t1 on t1.c = t4.c;
|
||||
select * from t1 natural join (t2 join t4 on b + 1 = y);
|
||||
select * from (t1 cross join t2) join (t3 cross join t4) on (a < y and t2.b < t3.c);
|
||||
|
||||
-- MySQL extension - 'join ... on' over nested comma operator
|
||||
select * from (t1, t2) join (t3, t4) on (a < y and t2.b < t3.c);
|
||||
select * from (t1 natural join t2) join (t3 natural join t4) on a = y;
|
||||
select * from ((t3 join (t1 join t2 on c > a) on t3.b < t2.a) join t4 on y > t1.c) join t5 on z = t1.b + 3;
|
||||
|
||||
-- MySQL extension - refererence qualified coalesced columns
|
||||
select * from t1 natural join t2 where t1.b > 0;
|
||||
select * from t1 natural join (t4 natural join t5) where t4.y > 7;
|
||||
select * from (t4 natural join t5) natural join t1 where t4.y > 7;
|
||||
select * from t1 natural left join (t4 natural join t5) where t4.y > 7;
|
||||
select * from (t4 natural join t5) natural right join t1 where t4.y > 7;
|
||||
select * from (t1 natural join t2) join (t3 natural join t4) on t1.b = t3.b;
|
||||
|
||||
-- MySQL extension - select qualified columns of NJ columns
|
||||
select t1.*, t2.* from t1 natural join t2;
|
||||
select t1.*, t2.*, t3.*, t4.* from (t1 natural join t2) natural join (t3 natural join t4);
|
||||
|
||||
-- Queries over subselects in the FROM clause
|
||||
select * from (select * from t1 natural join t2) as t12
|
||||
natural join
|
||||
(select * from t3 natural join t4) as t34;
|
||||
select * from (select * from t1 natural join t2) as t12
|
||||
natural left join
|
||||
(select * from t3 natural join t4) as t34;
|
||||
select * from (select * from t3 natural join t4) as t34
|
||||
natural right join
|
||||
(select * from t1 natural join t2) as t12;
|
||||
|
||||
-- Queries over views
|
||||
select * from v1a;
|
||||
select * from v1b;
|
||||
select * from v1c;
|
||||
select * from v1d;
|
||||
select * from v2a;
|
||||
select * from v2b;
|
||||
select * from v3a;
|
||||
select * from v3b;
|
||||
select * from v4;
|
||||
select * from v1a natural join v2a;
|
||||
select v2a.* from v1a natural join v2a;
|
||||
select * from v1b join v2a on v1b.b = v2a.c;
|
||||
select * from v1c join v2a on v1c.b = v2a.c;
|
||||
select * from v1d join v2a on v1d.a = v2a.c;
|
||||
select * from v1a join (t3 natural join t4) on a = y;
|
||||
|
||||
-- TODO: add tests with correlated subqueries for natural join/join on.
|
||||
-- related to BUG#15269
|
||||
|
||||
|
||||
----------------------------------------------------------------------
|
||||
-- Negative tests (tests for errors)
|
||||
----------------------------------------------------------------------
|
||||
-- error 1052
|
||||
select * from t1 natural join (t3 cross join t4); -- works in Oracle - bug
|
||||
-- error 1052
|
||||
select * from (t3 cross join t4) natural join t1; -- works in Oracle - bug
|
||||
-- error 1052
|
||||
select * from t1 join (t2, t3) using (b);
|
||||
-- error 1052
|
||||
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
|
||||
-- error 1052
|
||||
select * from ((t1 natural join t2), (t3 natural join t4)) natural join t6;
|
||||
-- error 1052
|
||||
-- BUG#15357: doesn't detect non-unique column 'c', as in the above query.
|
||||
-- select * from t6 natural join ((t1 natural join t2), (t3 natural join t4));
|
||||
-- error 1052
|
||||
select * from (t1 join t2 on t1.b=t2.b) natural join (t3 natural join t4);
|
||||
-- error 1052
|
||||
select * from (t3 natural join t4) natural join (t1 join t2 on t1.b=t2.b);
|
||||
-- this one is OK, the next equivalent one is incorrect (bug in Oracle)
|
||||
-- error 1052
|
||||
select * from (t3 join (t4 natural join t5) on (b < z))
|
||||
natural join
|
||||
(t1 natural join t2);
|
||||
-- error 1052
|
||||
-- BUG#15357: this query should return an ambiguous column error
|
||||
-- Expected result: the query must return error with duplicate column 'c'
|
||||
--select * from (t1 natural join t2)
|
||||
-- natural join
|
||||
-- (t3 join (t4 natural join t5) on (b < z));
|
||||
|
||||
-- error 1054
|
||||
select t1.b from v1a;
|
||||
-- error 1054
|
||||
select * from v1a join v1b on t1.b = t2.b;
|
||||
|
||||
drop table t1;
|
||||
drop table t2;
|
||||
drop table t3;
|
||||
drop table t4;
|
||||
drop table t5;
|
||||
drop table t6;
|
||||
|
||||
drop view v1a;
|
||||
drop view v1b;
|
||||
drop view v1c;
|
||||
drop view v1d;
|
||||
drop view v2a;
|
||||
drop view v2b;
|
||||
drop view v3a;
|
||||
drop view v3b;
|
||||
drop view v4;
|
||||
|
||||
# End of tests for WL#2486 - natural/using join
|
||||
|
@ -899,4 +899,4 @@ explain select * from t2 left join
|
||||
(t3 left join (t4 join t6 on t6.a=t4.b) on t4.a=t3.b
|
||||
join t5 on t5.a=t3.b) on t3.a=t2.b;
|
||||
|
||||
drop table t0, t1, t2, t4, t5, t6;
|
||||
drop table t0, t1, t2, t3, t4, t5, t6, t7;
|
||||
|
@ -605,6 +605,7 @@ select * from t2 order by a;
|
||||
|
||||
drop table t1, t2;
|
||||
drop database db1;
|
||||
|
||||
#
|
||||
# Bug #9558 mysqldump --no-data db t1 t2 format still dumps data
|
||||
#
|
||||
@ -644,7 +645,7 @@ select '------ Testing with illegal table names ------' as test_sequence ;
|
||||
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\t1" 2>&1
|
||||
|
||||
|
||||
--error 6
|
||||
--exec $MYSQL_DUMP --compact --skip-comments mysqldump_test_db "\\\\t1" 2>&1
|
||||
|
||||
@ -685,6 +686,7 @@ drop table t1, t2, t3;
|
||||
drop database mysqldump_test_db;
|
||||
use test;
|
||||
|
||||
|
||||
#
|
||||
# Bug #9657 mysqldump xml ( -x ) does not format NULL fields correctly
|
||||
#
|
||||
@ -1023,3 +1025,14 @@ SET SQL_MODE = @old_sql_mode;
|
||||
|
||||
DROP TRIGGER tr1;
|
||||
DROP TABLE t1;
|
||||
|
||||
#
|
||||
# Bug #13318: Bad result with empty field and --hex-blob
|
||||
#
|
||||
create table t1 (a binary(1), b blob);
|
||||
insert into t1 values ('','');
|
||||
--exec $MYSQL_DUMP --skip-comments --skip-extended-insert --hex-blob test t1
|
||||
--exec $MYSQL_DUMP --skip-comments --hex-blob test t1
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
@ -945,3 +945,49 @@ select "this will not be executed";
|
||||
--enable_parsing
|
||||
select "this will be executed";
|
||||
--enable_query_log
|
||||
|
||||
|
||||
#
|
||||
# Bug #11731 mysqltest in multi-statement queries ignores errors in
|
||||
# non-1st queries
|
||||
#
|
||||
|
||||
# Failing multi statement query
|
||||
--exec echo "delimiter ||||;" > var/tmp/bug11731.sql
|
||||
--exec echo "create table t1 (a int primary key);" >> var/tmp/bug11731.sql
|
||||
--exec echo "insert into t1 values (1);" >> var/tmp/bug11731.sql
|
||||
--exec echo "select 'select-me';" >> var/tmp/bug11731.sql
|
||||
--exec echo "insertz 'error query'||||" >> var/tmp/bug11731.sql
|
||||
--exec echo "delimiter ;||||" >> var/tmp/bug11731.sql
|
||||
|
||||
--error 1
|
||||
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql 2>&1
|
||||
drop table t1;
|
||||
|
||||
--error 1
|
||||
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
# The .out file should be empty, cat will fail!
|
||||
--error 1
|
||||
--exec cat $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
drop table t1;
|
||||
|
||||
|
||||
# Using expected error
|
||||
--exec echo "delimiter ||||;" > var/tmp/bug11731.sql
|
||||
--exec echo "--error 1064" >> var/tmp/bug11731.sql
|
||||
--exec echo "create table t1 (a int primary key);" >> var/tmp/bug11731.sql
|
||||
--exec echo "insert into t1 values (1);" >> var/tmp/bug11731.sql
|
||||
--exec echo "select 'select-me';" >> var/tmp/bug11731.sql
|
||||
--exec echo "insertz "error query"||||" >> var/tmp/bug11731.sql
|
||||
--exec echo "delimiter ;||||" >> var/tmp/bug11731.sql
|
||||
|
||||
# These two should work since the error is expected
|
||||
--exec $MYSQL_TEST -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql 2>&1
|
||||
drop table t1;
|
||||
|
||||
--exec $MYSQL_TEST --record -x $MYSQL_TEST_DIR/var/tmp/bug11731.sql -R $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
--exec cat $MYSQL_TEST_DIR/var/tmp/bug11731.out
|
||||
drop table t1;
|
||||
|
||||
|
||||
|
||||
|
@ -153,7 +153,7 @@ connection server1;
|
||||
alter table t1 drop index c;
|
||||
connection server2;
|
||||
# This should fail since index information is not automatically refreshed
|
||||
--error 1412
|
||||
--error 1015
|
||||
select * from t1 where b = 'two';
|
||||
select * from t1 where b = 'two';
|
||||
connection server1;
|
||||
|
@ -606,6 +606,14 @@ select * from t1 order by counter;
|
||||
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#14514 Creating table with packed key fails silently
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
@ -615,12 +623,3 @@ create table atablewithareallylongandirritatingname (a int);
|
||||
insert into atablewithareallylongandirritatingname values (2);
|
||||
select * from atablewithareallylongandirritatingname;
|
||||
drop table atablewithareallylongandirritatingname;
|
||||
|
||||
|
||||
#
|
||||
# BUG#14514
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( b INT ) PACK_KEYS = 0 ENGINE = ndb;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
@ -842,4 +842,44 @@ set @@tx_isolation=default;
|
||||
execute stmt;
|
||||
deallocate prepare stmt;
|
||||
|
||||
#
|
||||
# Bug#14410 "Crash in Enum or Set type in CREATE TABLE and PS/SP"
|
||||
#
|
||||
# Part I. Make sure the typelib for ENUM is created in the statement memory
|
||||
# root.
|
||||
prepare stmt from "create temporary table t1 (letter enum('','a','b','c')
|
||||
not null)";
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
# Part II. Make sure that when the default value is converted to UTF-8,
|
||||
# the new item is # created in the statement memory root.
|
||||
set names latin1;
|
||||
prepare stmt from "create table t1 (a enum('test') default 'test')
|
||||
character set utf8";
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
execute stmt;
|
||||
drop table t1;
|
||||
# Cleanup
|
||||
set names default;
|
||||
deallocate prepare stmt;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
# Bug #14956: ROW_COUNT() returns incorrect result after EXECUTE of prepared
|
||||
# statement
|
||||
#
|
||||
create table t1 (id int);
|
||||
prepare ins_call from "insert into t1 (id) values (1)";
|
||||
execute ins_call;
|
||||
select row_count();
|
||||
drop table t1;
|
||||
|
||||
# End of 5.0 tests
|
||||
|
@ -743,6 +743,19 @@ show status like "Qcache_hits";
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#14652: Queries with leading '(' characters.
|
||||
#
|
||||
create table t1 (a int);
|
||||
flush status;
|
||||
(select a from t1) union (select a from t1);
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
(select a from t1) union (select a from t1);
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
drop table t1;
|
||||
# SP cursors and selects with query cache (BUG#9715)
|
||||
#
|
||||
create table t1 (a int);
|
||||
|
@ -2253,6 +2253,17 @@ 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;
|
||||
drop table t1,t2;
|
||||
|
||||
#
|
||||
# Bug #14482 Server crash when subselecting from the same table
|
||||
#
|
||||
create table t1 (f1 int,f2 int);
|
||||
insert into t1 values(1,1);
|
||||
create table t2 (f3 int, f4 int, primary key(f3,f4));
|
||||
insert into t2 values(1,1);
|
||||
select * from t1 where f1 in (select f3 from t2 where (f3,f4)= (select f3,f4 from t2));
|
||||
drop table t1,t2;
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
@ -2749,3 +2760,48 @@ select f1, f2, v2.f1 as x1 from v2 order by v2.f1;
|
||||
select f1, f2, v3.f1 as x1 from v3 order by v3.f1;
|
||||
drop table t1;
|
||||
drop view v1, v2, v3;
|
||||
|
||||
#
|
||||
# Bug #15106: lost equality predicate of the form field=const in a join query
|
||||
#
|
||||
|
||||
CREATE TABLE t1(key_a int4 NOT NULL, optimus varchar(32), PRIMARY KEY(key_a));
|
||||
CREATE TABLE t2(key_a int4 NOT NULL, prime varchar(32), PRIMARY KEY(key_a));
|
||||
CREATE table t3(key_a int4 NOT NULL, key_b int4 NOT NULL, foo varchar(32),
|
||||
PRIMARY KEY(key_a,key_b));
|
||||
|
||||
INSERT INTO t1 VALUES (0,'');
|
||||
INSERT INTO t1 VALUES (1,'i');
|
||||
INSERT INTO t1 VALUES (2,'j');
|
||||
INSERT INTO t1 VALUES (3,'k');
|
||||
|
||||
INSERT INTO t2 VALUES (1,'r');
|
||||
INSERT INTO t2 VALUES (2,'s');
|
||||
INSERT INTO t2 VALUES (3,'t');
|
||||
|
||||
INSERT INTO t3 VALUES (1,5,'x');
|
||||
INSERT INTO t3 VALUES (1,6,'y');
|
||||
INSERT INTO t3 VALUES (2,5,'xx');
|
||||
INSERT INTO t3 VALUES (2,6,'yy');
|
||||
INSERT INTO t3 VALUES (2,7,'zz');
|
||||
INSERT INTO t3 VALUES (3,5,'xxx');
|
||||
|
||||
SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
EXPLAIN SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t1.key_a = t2.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
|
||||
SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
EXPLAIN SELECT t2.key_a,foo
|
||||
FROM t1 INNER JOIN t2 ON t2.key_a = t1.key_a
|
||||
INNER JOIN t3 ON t1.key_a = t3.key_a
|
||||
WHERE t2.key_a=2 and key_b=5;
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
@ -1211,15 +1211,13 @@ begin
|
||||
end if;
|
||||
end|
|
||||
select f5(1)|
|
||||
# This should generate an error about insuficient number of tables locked
|
||||
# Now this crash server
|
||||
--disable_parsing # until bug#11394 fix
|
||||
--error 1100
|
||||
# Since currently recursive functions are disallowed ER_SP_NO_RECURSION
|
||||
# error will be returned, once we will allow them error about
|
||||
# insufficient number of locked tables will be returned instead.
|
||||
--error ER_SP_NO_RECURSION
|
||||
select f5(2)|
|
||||
# But now it simply miserably fails because we are trying to use the same
|
||||
# lex on the next iteration :/ It should generate some error too...
|
||||
--error ER_SP_NO_RECURSION
|
||||
select f5(3)|
|
||||
--enable_parsing
|
||||
|
||||
# OTOH this should work
|
||||
create function f6() returns int
|
||||
@ -1265,13 +1263,12 @@ select * from v1|
|
||||
# views and functions ?
|
||||
create function f1() returns int
|
||||
return (select sum(data) from t1) + (select sum(data) from v1)|
|
||||
# This queries will crash server because we can't use LEX in
|
||||
# reenterable fashion yet. Patch disabling recursion will heal this.
|
||||
--disable_parsing
|
||||
--error ER_SP_NO_RECURSION
|
||||
select f1()|
|
||||
--error ER_SP_NO_RECURSION
|
||||
select * from v1|
|
||||
--error ER_SP_NO_RECURSION
|
||||
select * from v2|
|
||||
--enable_parsing
|
||||
# Back to the normal cases
|
||||
drop function f1|
|
||||
create function f1() returns int
|
||||
@ -1289,9 +1286,7 @@ select *, f0() from v0|
|
||||
#
|
||||
# Let us test how well prelocking works with explicit LOCK TABLES.
|
||||
#
|
||||
# Nowdays we have to lock mysql.proc to be able to read SP definitions.
|
||||
# But Monty was going to fix this.
|
||||
lock tables t1 read, t1 as t11 read, mysql.proc read|
|
||||
lock tables t1 read, t1 as t11 read|
|
||||
# These should work well
|
||||
select f3()|
|
||||
select id, f3() from t1 as t11|
|
||||
@ -1481,9 +1476,6 @@ show procedure status like '%p%'|
|
||||
|
||||
# Fibonacci, for recursion test. (Yet Another Numerical series :)
|
||||
#
|
||||
# This part of test is disabled until we implement support for
|
||||
# recursive stored procedures.
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop table if exists fib|
|
||||
--enable_warnings
|
||||
@ -1512,6 +1504,9 @@ begin
|
||||
end if;
|
||||
end|
|
||||
|
||||
# Enable recursion
|
||||
set @@max_sp_recursion_depth= 20|
|
||||
|
||||
# Minimum test: recursion of 3 levels
|
||||
|
||||
insert into fib values (0), (1)|
|
||||
@ -1531,7 +1526,7 @@ call fib(20)|
|
||||
select * from fib order by f asc|
|
||||
drop table fib|
|
||||
drop procedure fib|
|
||||
--enable_parsing
|
||||
set @@max_sp_recursion_depth= 0|
|
||||
|
||||
#
|
||||
# Comment & suid
|
||||
@ -1800,16 +1795,8 @@ select @x2|
|
||||
drop procedure bug2260|
|
||||
|
||||
#
|
||||
# BUG#2267
|
||||
# BUG#2267 "Lost connect if stored procedure has SHOW FUNCTION STATUS"
|
||||
#
|
||||
# NOTE: This test case will be fixed as soon as Monty
|
||||
# will allow to open mysql.proc table under LOCK TABLES
|
||||
# without mentioning in lock list.
|
||||
#
|
||||
# FIXME: Other solution would be to use preopened proc table
|
||||
# instead of opening it anew.
|
||||
#
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_1|
|
||||
--enable_warnings
|
||||
@ -1836,11 +1823,13 @@ end|
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2267_4|
|
||||
drop function if exists bug2267_4|
|
||||
--enable_warnings
|
||||
create procedure bug2267_4()
|
||||
begin
|
||||
show create function fac;
|
||||
show create function bug2267_4;
|
||||
end|
|
||||
create function bug2267_4() returns int return 100|
|
||||
|
||||
--replace_column 5 '0000-00-00 00:00:00' 6 '0000-00-00 00:00:00'
|
||||
call bug2267_1()|
|
||||
@ -1853,7 +1842,7 @@ drop procedure bug2267_1|
|
||||
drop procedure bug2267_2|
|
||||
drop procedure bug2267_3|
|
||||
drop procedure bug2267_4|
|
||||
--enable_parsing
|
||||
drop function bug2267_4|
|
||||
|
||||
#
|
||||
# BUG#2227
|
||||
@ -1873,23 +1862,16 @@ call bug2227(9)|
|
||||
drop procedure bug2227|
|
||||
|
||||
#
|
||||
# BUG#2614
|
||||
# BUG#2614 "Stored procedure with INSERT ... SELECT that does not
|
||||
# contain any tables crashes server"
|
||||
#
|
||||
# QQ The second insert doesn't work with temporary tables (it was an
|
||||
# QQ ordinary table before we changed the locking scheme). It results
|
||||
# QQ in an error: 1137: Can't reopen table: 't3'
|
||||
# QQ which is a known limit with temporary tables.
|
||||
# QQ For this reason we can't run this test any more (i.e., if we modify
|
||||
# QQ it, it's no longer a test case for the bug), but we keep it here
|
||||
# QQ anyway, for tracability.
|
||||
--disable_parsing
|
||||
--disable_warnings
|
||||
drop procedure if exists bug2614|
|
||||
--enable_warnings
|
||||
create procedure bug2614()
|
||||
begin
|
||||
drop temporary table if exists t3;
|
||||
create temporary table t3 (id int default '0' not null);
|
||||
drop table if exists t3;
|
||||
create table t3 (id int default '0' not null);
|
||||
insert into t3 select 12;
|
||||
insert into t3 select * from t3;
|
||||
end|
|
||||
@ -1898,9 +1880,8 @@ end|
|
||||
call bug2614()|
|
||||
--enable_warnings
|
||||
call bug2614()|
|
||||
drop temporary table t3|
|
||||
drop table t3|
|
||||
drop procedure bug2614|
|
||||
--enable_parsing
|
||||
|
||||
#
|
||||
# BUG#2674
|
||||
@ -4773,8 +4754,196 @@ drop procedure bug10100pv|
|
||||
drop procedure bug10100pd|
|
||||
drop procedure bug10100pc|
|
||||
drop view v1|
|
||||
|
||||
#
|
||||
# BUG#13729: Stored procedures: packet error after exception handled
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug13729|
|
||||
drop table if exists t3|
|
||||
--enable_warnings
|
||||
|
||||
create table t3 (s1 int, primary key (s1))|
|
||||
|
||||
insert into t3 values (1),(2)|
|
||||
|
||||
create procedure bug13729()
|
||||
begin
|
||||
declare continue handler for sqlexception select 55;
|
||||
|
||||
update t3 set s1 = 1;
|
||||
end|
|
||||
|
||||
call bug13729()|
|
||||
# Used to cause Packets out of order
|
||||
select * from t3|
|
||||
|
||||
drop procedure bug13729|
|
||||
drop table t3|
|
||||
|
||||
#
|
||||
# BUG#14643: Stored Procedure: Continuing after failed var. initialization
|
||||
# crashes server.
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug14643_1|
|
||||
drop procedure if exists bug14643_2|
|
||||
--enable_warnings
|
||||
|
||||
create procedure bug14643_1()
|
||||
begin
|
||||
declare continue handler for sqlexception select 'boo' as 'Handler';
|
||||
|
||||
begin
|
||||
declare v int default x;
|
||||
|
||||
if v = 1 then
|
||||
select 1;
|
||||
else
|
||||
select 2;
|
||||
end if;
|
||||
end;
|
||||
end|
|
||||
|
||||
create procedure bug14643_2()
|
||||
begin
|
||||
declare continue handler for sqlexception select 'boo' as 'Handler';
|
||||
|
||||
case x
|
||||
when 1 then
|
||||
select 1;
|
||||
else
|
||||
select 2;
|
||||
end case;
|
||||
end|
|
||||
|
||||
call bug14643_1()|
|
||||
call bug14643_2()|
|
||||
|
||||
drop procedure bug14643_1|
|
||||
drop procedure bug14643_2|
|
||||
|
||||
#
|
||||
# BUG#14304: auto_increment field incorrect set in SP
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug14304|
|
||||
drop table if exists t3, t4|
|
||||
--enable_warnings
|
||||
|
||||
create table t3(a int primary key auto_increment)|
|
||||
create table t4(a int primary key auto_increment)|
|
||||
|
||||
create procedure bug14304()
|
||||
begin
|
||||
insert into t3 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 set a=null;
|
||||
insert into t4 select null as a;
|
||||
|
||||
insert into t3 set a=null;
|
||||
insert into t3 set a=null;
|
||||
|
||||
select * from t3;
|
||||
end|
|
||||
|
||||
call bug14304()|
|
||||
|
||||
drop procedure bug14304|
|
||||
drop table t3, t4|
|
||||
|
||||
#
|
||||
# BUG#14376: MySQL crash on scoped variable (re)initialization
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists bug14376|
|
||||
--enable_warnings
|
||||
|
||||
create procedure bug14376()
|
||||
begin
|
||||
declare x int default x;
|
||||
end|
|
||||
|
||||
# Not the error we want, but that's what we got for now...
|
||||
--error ER_BAD_FIELD_ERROR
|
||||
call bug14376()|
|
||||
drop procedure bug14376|
|
||||
|
||||
create procedure bug14376()
|
||||
begin
|
||||
declare x int default 42;
|
||||
|
||||
begin
|
||||
declare x int default x;
|
||||
|
||||
select x;
|
||||
end;
|
||||
end|
|
||||
|
||||
call bug14376()|
|
||||
|
||||
drop procedure bug14376|
|
||||
|
||||
create procedure bug14376(x int)
|
||||
begin
|
||||
declare x int default x;
|
||||
|
||||
select x;
|
||||
end|
|
||||
|
||||
call bug14376(4711)|
|
||||
|
||||
drop procedure bug14376|
|
||||
|
||||
#
|
||||
# Bug#5967 "Stored procedure declared variable used instead of column"
|
||||
# The bug should be fixed later.
|
||||
# Test precedence of names of parameters, variable declarations,
|
||||
# variable declarations in nested compound statements, table columns,
|
||||
# table columns in cursor declarations.
|
||||
# According to the standard, table columns take precedence over
|
||||
# variable declarations. In MySQL 5.0 it's vice versa.
|
||||
#
|
||||
|
||||
drop procedure if exists p1|
|
||||
drop table if exists t1|
|
||||
create table t1 (a varchar(255))|
|
||||
insert into t1 (a) values ("a - table column")|
|
||||
create procedure p1(a varchar(255))
|
||||
begin
|
||||
declare i varchar(255);
|
||||
declare c cursor for select a from t1;
|
||||
select a;
|
||||
select a from t1 into i;
|
||||
select i as 'Parameter takes precedence over table column'; open c;
|
||||
fetch c into i;
|
||||
close c;
|
||||
select i as 'Parameter takes precedence over table column in cursors';
|
||||
begin
|
||||
declare a varchar(255) default 'a - local variable';
|
||||
declare c1 cursor for select a from t1;
|
||||
select a as 'A local variable takes precedence over parameter';
|
||||
open c1;
|
||||
fetch c1 into i;
|
||||
close c1;
|
||||
select i as 'A local variable takes precedence over parameter in cursors';
|
||||
begin
|
||||
declare a varchar(255) default 'a - local variable in a nested compound statement';
|
||||
declare c2 cursor for select a from t1;
|
||||
select a as 'A local variable in a nested compound statement takes precedence over a local variable in the outer statement';
|
||||
select a from t1 into i;
|
||||
select i as 'A local variable in a nested compound statement takes precedence over table column';
|
||||
open c2;
|
||||
fetch c2 into i;
|
||||
close c2;
|
||||
select i as 'A local variable in a nested compound statement takes precedence over table column in cursors';
|
||||
end;
|
||||
end;
|
||||
end|
|
||||
call p1("a - stored procedure parameter")|
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
|
@ -355,6 +355,70 @@ drop procedure bug13825_2|
|
||||
drop table t1, t2|
|
||||
|
||||
|
||||
#
|
||||
# BUG#14840: CONTINUE handler problem
|
||||
#
|
||||
--disable_warnings
|
||||
drop table if exists t3|
|
||||
drop procedure if exists bug14840_1|
|
||||
drop procedure if exists bug14840_2|
|
||||
--enable_warnings
|
||||
|
||||
create table t3
|
||||
(
|
||||
x int,
|
||||
y int,
|
||||
primary key (x)
|
||||
) engine=InnoDB|
|
||||
|
||||
# This used to hang the client since the insert returned with an
|
||||
# error status (left over from the update) even though it succeeded,
|
||||
# which caused the execution to end at that point.
|
||||
create procedure bug14840_1()
|
||||
begin
|
||||
declare err int default 0;
|
||||
declare continue handler for sqlexception
|
||||
set err = err + 1;
|
||||
|
||||
start transaction;
|
||||
update t3 set x = 1, y = 42 where x = 2;
|
||||
insert into t3 values (3, 4711);
|
||||
if err > 0 then
|
||||
rollback;
|
||||
else
|
||||
commit;
|
||||
end if;
|
||||
select * from t3;
|
||||
end|
|
||||
|
||||
# A simpler (non-transactional) case: insert at select should be done
|
||||
create procedure bug14840_2()
|
||||
begin
|
||||
declare err int default 0;
|
||||
declare continue handler for sqlexception
|
||||
begin
|
||||
set err = err + 1;
|
||||
select err as 'Ping';
|
||||
end;
|
||||
|
||||
update t3 set x = 1, y = 42 where x = 2;
|
||||
update t3 set x = 1, y = 42 where x = 2;
|
||||
insert into t3 values (3, 4711);
|
||||
select * from t3;
|
||||
end|
|
||||
|
||||
insert into t3 values (1, 3), (2, 5)|
|
||||
call bug14840_1()|
|
||||
|
||||
delete from t3|
|
||||
insert into t3 values (1, 3), (2, 5)|
|
||||
call bug14840_2()|
|
||||
|
||||
drop procedure bug14840_1|
|
||||
drop procedure bug14840_2|
|
||||
drop table t3|
|
||||
|
||||
|
||||
#
|
||||
# BUG#NNNN: New bug synopsis
|
||||
#
|
||||
|
31
mysql-test/t/type_newdecimal-big.test
Normal file
31
mysql-test/t/type_newdecimal-big.test
Normal file
@ -0,0 +1,31 @@
|
||||
--source include/big_test.inc
|
||||
|
||||
--disable_warnings
|
||||
drop procedure if exists sp1;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
#-- 2. Adding (one millionth) one million times should be the same as
|
||||
#-- adding 1. So a stored procedure with many iterations will show if
|
||||
#-- small errors accumulate.
|
||||
#
|
||||
|
||||
delimiter //;
|
||||
#
|
||||
create procedure sp1 () begin
|
||||
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
|
||||
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
|
||||
while v5 < 100000 do
|
||||
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
|
||||
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
|
||||
#
|
||||
call sp1()//
|
||||
#-- should return
|
||||
# -- v1=1.0000001
|
||||
# -- v2=1.999999900000
|
||||
# -- v3=1.0000001
|
||||
# -- v4=1.999999900000
|
||||
#
|
||||
delimiter ;//
|
||||
#
|
||||
drop procedure sp1;
|
@ -473,7 +473,7 @@ drop table wl1612_4;
|
||||
#
|
||||
#-- Additional tests for WL#1612 Precision math
|
||||
#
|
||||
#-- 1. Comparisons should show that a number is
|
||||
#-- Comparisons should show that a number is
|
||||
#-- exactly equal to its value as displayed.
|
||||
#
|
||||
set sql_mode='';
|
||||
@ -487,34 +487,9 @@ select 18.3=18.3;
|
||||
select -18.3=18.3;
|
||||
#
|
||||
select 0.8 = 0.7 + 0.1;
|
||||
|
||||
#
|
||||
#-- 2. Adding (one millionth) one million times should be the same as
|
||||
#-- adding 1. So a stored procedure with many iterations will show if
|
||||
#-- small errors accumulate.
|
||||
#
|
||||
#drop procedure p1;
|
||||
#
|
||||
delimiter //;
|
||||
#
|
||||
create procedure p1 () begin
|
||||
declare v1, v2, v3, v4 decimal(16,12); declare v5 int;
|
||||
set v1 = 1; set v2 = 2; set v3 = 1000000000000; set v4 = 2000000000000; set v5 = 0;
|
||||
while v5 < 100000 do
|
||||
set v1 = v1 + 0.000000000001; set v2 = v2 - 0.000000000001; set v3 = v3 + 1; set v4 = v4 - 1; set v5 = v5 + 1;
|
||||
end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
|
||||
#
|
||||
call p1()//
|
||||
#-- should return
|
||||
# -- v1=1.0000001
|
||||
# -- v2=1.999999900000
|
||||
# -- v3=1.0000001
|
||||
# -- v4=1.999999900000
|
||||
#
|
||||
delimiter ;//
|
||||
#
|
||||
drop procedure p1;
|
||||
#
|
||||
#-- 3. It should be possible to define a column
|
||||
#-- It should be possible to define a column
|
||||
#-- with up to 38 digits precision either before
|
||||
#-- or after the decimal point. Any number which
|
||||
#-- is inserted, if it's within the range, should
|
||||
@ -565,7 +540,7 @@ select * from t1;
|
||||
#
|
||||
drop table t1;
|
||||
#
|
||||
#-- 4. The usual arithmetic operators / * + - should work.
|
||||
#-- The usual arithmetic operators / * + - should work.
|
||||
#
|
||||
#select 77777777777777777777777777777777777777 / 7777777777777777777777777777777777777 = 10;
|
||||
#-- should return 0 (false).
|
||||
@ -668,7 +643,7 @@ select truncate(99999999999999999999999999999999999999,-31);
|
||||
#drop procedure p1;
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 7. When I say DECIMAL(x) I should be able to store x digits.
|
||||
#-- When I say DECIMAL(x) I should be able to store x digits.
|
||||
#-- If I can't, there should be an error at CREATE time.
|
||||
#
|
||||
#drop table if exists t1;
|
||||
@ -676,7 +651,8 @@ select truncate(99999999999999999999999999999999999999,-31);
|
||||
#create table t1 (col1 decimal(254));
|
||||
#-- should return SQLSTATE 22003 numeric value out of range
|
||||
#
|
||||
#-- 8. When I say DECIMAL(x,y) there should be no silent change of precision or scale.
|
||||
#-- When I say DECIMAL(x,y) there should be no silent change of precision or
|
||||
#-- scale.
|
||||
#
|
||||
#drop table if exists t1;
|
||||
#
|
||||
@ -694,7 +670,7 @@ select truncate(99999999999999999999999999999999999999,-31);
|
||||
#
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 9. From WL#1612 "The future" point 2.:
|
||||
#-- From WL#1612 "The future" point 2.:
|
||||
#-- The standard requires that we treat numbers like "0.5" as
|
||||
#-- DECIMAL or NUMERIC, not as floating-point.
|
||||
#
|
||||
@ -715,7 +691,7 @@ show create table t1;
|
||||
#
|
||||
drop table t1;
|
||||
#
|
||||
#-- 10. From WL#1612, "The future", point 3.: We have to start rounding correctly.
|
||||
#-- From WL#1612, "The future", point 3.: We have to start rounding correctly.
|
||||
#
|
||||
select round(1.5),round(2.5);
|
||||
#-- should return:
|
||||
@ -725,13 +701,13 @@ select round(1.5),round(2.5);
|
||||
#| 2 | 3 |
|
||||
#+------------+------------+
|
||||
#
|
||||
#-- 11. From WL#1612, "The future", point 4.: "select 0.07 * 0.07;" should return 0.0049, not 0.00.
|
||||
#-- From WL#1612, "The future", point 4.: "select 0.07 * 0.07;" should return 0.0049, not 0.00.
|
||||
#-- If operand#1 has scale X and operand#2 has scale Y, then result should have scale (X+Y).
|
||||
#
|
||||
select 0.07 * 0.07;
|
||||
#-- should return 0.0049
|
||||
#
|
||||
#-- 12. From WL#1612, "The future", point 5.: Division by zero is an error.
|
||||
#-- From WL#1612, "The future", point 5.: Division by zero is an error.
|
||||
#
|
||||
set sql_mode='traditional';
|
||||
#
|
||||
@ -752,7 +728,7 @@ select 1 / 0;
|
||||
#+-------+
|
||||
#1 row in set, 1 warning (0.00 sec)
|
||||
#
|
||||
#-- 13. From WL#1612 "The future" point 6.: Overflow is an error.
|
||||
#-- From WL#1612 "The future" point 6.: Overflow is an error.
|
||||
#
|
||||
#set sql_mode='';
|
||||
#
|
||||
@ -793,7 +769,8 @@ select 1 / 0;
|
||||
#drop table t2;
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 15. From WL#1612 "The future" point 8.: Stop storing leading "+" signs and leading "0"s.
|
||||
#-- From WL#1612 "The future" point 8.: Stop storing leading "+" signs and
|
||||
# leading "0"s.
|
||||
#
|
||||
#drop table if exists t1;
|
||||
#
|
||||
@ -805,7 +782,7 @@ select 1 / 0;
|
||||
#
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 16. From WL#1612, The future" point 9.:
|
||||
#-- From WL#1612, The future" point 9.:
|
||||
#-- Accept the data type and precision and scale as the user
|
||||
#-- asks, or return an error, but don't change to something else.
|
||||
#
|
||||
@ -817,7 +794,7 @@ select 1 / 0;
|
||||
#
|
||||
#drop table t1;
|
||||
#
|
||||
#-- 17. The scripts in the following bugs should work:
|
||||
#-- The scripts in the following bugs should work:
|
||||
#
|
||||
|
||||
#BUG#559 Maximum precision for DECIMAL column ...
|
||||
@ -833,7 +810,7 @@ select 1 / 0;
|
||||
#BUG#6048 Stored procedure causes operating system reboot
|
||||
#BUG#6053 DOUBLE PRECISION literal
|
||||
|
||||
-- 18. Tests from 'traditional' mode tests
|
||||
-- Tests from 'traditional' mode tests
|
||||
#
|
||||
set sql_mode='ansi,traditional';
|
||||
#
|
||||
@ -1077,10 +1054,17 @@ SELECT CAST(my_float AS DECIMAL(65,30)), my_float FROM t1;
|
||||
SELECT CAST(my_double AS DECIMAL(65,30)), my_double FROM t1;
|
||||
SELECT CAST(my_varchar AS DECIMAL(65,30)), my_varchar FROM t1;
|
||||
|
||||
# We have to disable warnings here as the test in
|
||||
# Field_new_decimal::store(double):
|
||||
# if (nr2 != nr)
|
||||
# fails randomly depending on compiler options
|
||||
|
||||
--disable_warnings
|
||||
UPDATE t1 SET my_decimal = my_float;
|
||||
SELECT my_decimal, my_float FROM t1;
|
||||
UPDATE t1 SET my_decimal = my_double;
|
||||
SELECT my_decimal, my_double FROM t1;
|
||||
--enable_warnings
|
||||
UPDATE t1 SET my_decimal = my_varchar;
|
||||
SELECT my_decimal, my_varchar FROM t1;
|
||||
|
||||
|
@ -753,6 +753,24 @@ create table t2 select a from t1 union select b from t1;
|
||||
show columns from t2;
|
||||
drop table t2, t1;
|
||||
|
||||
#
|
||||
# Bug #14216: UNION + DECIMAL wrong values in result
|
||||
#
|
||||
create table t1 (f1 decimal(60,25), f2 decimal(60,25));
|
||||
insert into t1 values (0.0,0.0);
|
||||
select f1 from t1 union all select f2 from t1;
|
||||
select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
|
||||
union all
|
||||
select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
|
||||
drop table t1;
|
||||
create table t1 (f1 decimal(60,24), f2 decimal(60,24));
|
||||
insert into t1 values (0.0,0.0);
|
||||
select f1 from t1 union all select f2 from t1;
|
||||
select 'XXXXXXXXXXXXXXXXXXXX' as description, f1 from t1
|
||||
union all
|
||||
select 'YYYYYYYYYYYYYYYYYYYY' as description, f2 from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Test that union with VARCHAR produces dynamic row tables
|
||||
#
|
||||
|
@ -270,4 +270,21 @@ insert into t1 values('2000-01-01'),('0000-00-00');
|
||||
update t1 set f1='2002-02-02' where f1 is null;
|
||||
select * from t1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Bug#15028 Multitable update returns different numbers of matched rows
|
||||
# depending on table order
|
||||
create table t1 (f1 int);
|
||||
create table t2 (f2 int);
|
||||
insert into t1 values(1),(2);
|
||||
insert into t2 values(1),(1);
|
||||
--enable_info
|
||||
update t1,t2 set f1=3,f2=3 where f1=f2 and f1=1;
|
||||
--disable_info
|
||||
update t2 set f2=1;
|
||||
update t1 set f1=1 where f1=3;
|
||||
--enable_info
|
||||
update t2,t1 set f1=3,f2=3 where f1=f2 and f1=1;
|
||||
--disable_info
|
||||
drop table t1,t2;
|
||||
# End of 4.1 tests
|
||||
|
@ -2280,3 +2280,43 @@ create view v1 as select * from t1;
|
||||
select f1, sum(f2) from v1 group by f1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#14885: incorrect SOURCE in view created in a procedure
|
||||
# TODO: here SOURCE string must be shown when it will be possible
|
||||
#
|
||||
--disable_warnings
|
||||
drop procedure if exists p1;
|
||||
--enable_warnings
|
||||
delimiter //;
|
||||
create procedure p1 () deterministic
|
||||
begin
|
||||
create view v1 as select 1;
|
||||
end;
|
||||
//
|
||||
delimiter ;//
|
||||
call p1();
|
||||
show create view v1;
|
||||
drop view v1;
|
||||
drop procedure p1;
|
||||
|
||||
#
|
||||
# BUG#15096: using function with view for view creation
|
||||
#
|
||||
CREATE VIEW v1 AS SELECT 42 AS Meaning;
|
||||
--disable_warnings
|
||||
DROP FUNCTION IF EXISTS f1;
|
||||
--enable_warnings
|
||||
DELIMITER //;
|
||||
CREATE FUNCTION f1() RETURNS INTEGER
|
||||
BEGIN
|
||||
DECLARE retn INTEGER;
|
||||
SELECT Meaning FROM v1 INTO retn;
|
||||
RETURN retn;
|
||||
END
|
||||
//
|
||||
DELIMITER ;//
|
||||
CREATE VIEW v2 AS SELECT f1();
|
||||
select * from v2;
|
||||
drop view v2,v1;
|
||||
drop function f1;
|
||||
|
@ -96,4 +96,35 @@ unlock tables;
|
||||
set query_cache_wlock_invalidate=default;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# BUG#15119: returning temptable view from the query cache.
|
||||
#
|
||||
flush status;
|
||||
create table t1 (a int, b int);
|
||||
create algorithm=temptable view v1 as select * from t1;
|
||||
select * from v1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
select * from v1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
insert into t1 values (1,1);
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
select * from v1;
|
||||
select * from v1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
drop view v1;
|
||||
show status like "Qcache_queries_in_cache";
|
||||
show status like "Qcache_inserts";
|
||||
show status like "Qcache_hits";
|
||||
drop table t1;
|
||||
|
||||
# Reset default environment.
|
||||
set GLOBAL query_cache_size=default;
|
||||
|
Reference in New Issue
Block a user