summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/alter_table.test11
-rw-r--r--mysql-test/t/func_math.test4
-rw-r--r--mysql-test/t/grant.test16
-rw-r--r--mysql-test/t/having.test46
-rw-r--r--mysql-test/t/heap.test14
-rw-r--r--mysql-test/t/myisam.test9
-rw-r--r--mysql-test/t/type_date.test19
-rw-r--r--mysql-test/t/type_float.test6
-rw-r--r--mysql-test/t/type_timestamp.test11
-rw-r--r--mysql-test/t/type_uint.test1
10 files changed, 134 insertions, 3 deletions
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index 5fed85d7f50..317af337c46 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -312,3 +312,14 @@ insert into t1 values (1,1), (2,2);
alter table t1 drop key no_such_key;
alter table t1 drop key a;
drop table t1;
+
+#
+# BUG#4717 - check for valid table names
+#
+create table t1 (a int);
+--error 1103
+alter table t1 rename to `t1\\`;
+--error 1103
+rename table t1 to `t1\\`;
+drop table t1;
+
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 36ad2dfb0a2..e58c097b5a6 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -26,8 +26,8 @@ explain extended select pow(10,log10(10)),power(2,4);
set @@rand_seed1=10000000,@@rand_seed2=1000000;
select rand(999999),rand();
explain extended select rand(999999),rand();
-select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
-explain extended select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
+select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
+explain extended select pi(),format(sin(pi()/2),6),format(cos(pi()/2),6),format(abs(tan(pi())),6),format(cot(1),6),format(asin(1),6),format(acos(0),6),format(atan(1),6);
select degrees(pi()),radians(360);
#
diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test
index c112a0e0c1d..e1319690dc5 100644
--- a/mysql-test/t/grant.test
+++ b/mysql-test/t/grant.test
@@ -173,3 +173,19 @@ REVOKE SELECT (ËÏÌ) ON ÂÄ.ÔÁÂ FROM ÀÚÅÒ@localhost;
DROP DATABASE ÂÄ;
SET NAMES latin1;
+
+#
+# Bug #4898: User privileges depending on ORDER BY Settings of table db
+#
+insert into mysql.user (host, user) values ('localhost', 'test11');
+insert into mysql.db (host, db, user, select_priv) values
+('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y');
+alter table mysql.db order by db asc;
+flush privileges;
+show grants for test11@localhost;
+alter table mysql.db order by db desc;
+flush privileges;
+show grants for test11@localhost;
+delete from mysql.user where user='test11';
+delete from mysql.db where user='test11';
+
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index 7e4cbe76cca..4c0a4bacd56 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -75,3 +75,49 @@ select id, sum(qty) as sqty from t1 group by id having sqty>2;
select sum(qty) as sqty from t1 group by id having count(id) > 0;
select sum(qty) as sqty from t1 group by id having count(distinct id) > 0;
drop table t1;
+
+#
+# Test case for Bug #4358 Problem with HAVING clause that uses alias from the
+# select list and TEXT field
+#
+
+CREATE TABLE t1 (
+ `id` bigint(20) NOT NULL default '0',
+ `description` text
+) TYPE=MyISAM;
+
+CREATE TABLE t2 (
+ `id` bigint(20) NOT NULL default '0',
+ `description` varchar(20)
+) TYPE=MyISAM;
+
+INSERT INTO t1 VALUES (1, 'test');
+INSERT INTO t2 VALUES (1, 'test');
+
+CREATE TABLE t3 (
+ `id` bigint(20) NOT NULL default '0',
+ `order_id` bigint(20) NOT NULL default '0'
+) TYPE=MyISAM;
+
+select
+ a.id, a.description,
+ count(b.id) as c
+from t1 a left join t3 b on a.id=b.order_id
+group by a.id, a.description
+having (a.description is not null) and (c=0);
+
+select
+ a.*,
+ count(b.id) as c
+from t2 a left join t3 b on a.id=b.order_id
+group by a.id, a.description
+having (a.description is not null) and (c=0);
+
+INSERT INTO t1 VALUES (2, 'test2');
+
+select
+ a.id, a.description,
+ count(b.id) as c
+from t1 a left join t3 b on a.id=b.order_id
+group by a.id, a.description
+having (a.description is not null) and (c=0);
diff --git a/mysql-test/t/heap.test b/mysql-test/t/heap.test
index d867d5f4323..56442dfd6fd 100644
--- a/mysql-test/t/heap.test
+++ b/mysql-test/t/heap.test
@@ -150,3 +150,17 @@ INSERT into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11);
DELETE from t1 where a < 100;
SELECT * from t1;
DROP TABLE t1;
+
+#
+# Bug#4411 Server hangs when trying to SELECT MAX(id) from an empty HEAP table
+#
+CREATE TABLE `job_titles` (
+ `job_title_id` int(6) unsigned NOT NULL default '0',
+ `job_title` char(18) NOT NULL default '',
+ PRIMARY KEY (`job_title_id`),
+ UNIQUE KEY `job_title_id` (`job_title_id`,`job_title`)
+) TYPE=HEAP;
+
+SELECT MAX(job_title_id) FROM job_titles;
+
+DROP TABLE job_titles;
diff --git a/mysql-test/t/myisam.test b/mysql-test/t/myisam.test
index 298a8b1b61b..e6d47b5c570 100644
--- a/mysql-test/t/myisam.test
+++ b/mysql-test/t/myisam.test
@@ -502,3 +502,12 @@ alter table t1 disable keys;
show keys from t1;
drop table t1,t2;
+#
+# index search for NULL in blob. Bug #4816
+#
+create table t1 ( a tinytext, b char(1), index idx (a(1),b) );
+insert into t1 values (null,''), (null,'');
+explain select count(*) from t1 where a is null;
+select count(*) from t1 where a is null;
+drop table t1;
+
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index 8d67802d42a..64420a85189 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -88,3 +88,22 @@ CREATE TABLE t1 (f1 time default NULL, f2 time default NULL);
INSERT INTO t1 (f1, f2) VALUES ('09:00', '12:00');
SELECT DATE_FORMAT(f1, "%l.%i %p") , DATE_FORMAT(f2, "%l.%i %p") FROM t1;
DROP TABLE t1;
+
+#
+# Bug 4937: different date -> string conversion when using SELECT ... UNION
+# and INSERT ... SELECT ... UNION
+#
+
+CREATE TABLE t1 (f1 DATE);
+CREATE TABLE t2 (f2 VARCHAR(8));
+CREATE TABLE t3 (f2 CHAR(8));
+
+INSERT INTO t1 VALUES ('1978-11-26');
+INSERT INTO t2 SELECT f1+0 FROM t1;
+INSERT INTO t2 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1;
+INSERT INTO t3 SELECT f1+0 FROM t1;
+INSERT INTO t3 SELECT f1+0 FROM t1 UNION SELECT f1+0 FROM t1;
+SELECT * FROM t2;
+SELECT * FROM t3;
+
+DROP TABLE t1, t2, t3;
diff --git a/mysql-test/t/type_float.test b/mysql-test/t/type_float.test
index d3ddecfc314..cfaa5d611f2 100644
--- a/mysql-test/t/type_float.test
+++ b/mysql-test/t/type_float.test
@@ -31,10 +31,14 @@ select a from t1 order by a;
select min(a) from t1;
drop table t1;
+#
+# BUG#3612, BUG#4393, BUG#4356, BUG#4394
+#
+
create table t1 (c1 double, c2 varchar(20));
insert t1 values (121,"16");
select c1 + c1 * (c2 / 100) as col from t1;
-create table t2 select c1 + c1 * (c2 / 100) as col from t1;
+create table t2 select c1 + c1 * (c2 / 100) as col1, round(c1, 5) as col2, round(c1, 35) as col3, sqrt(c1*1e-15) col4 from t1;
select * from t2;
show create table t2;
drop table t1,t2;
diff --git a/mysql-test/t/type_timestamp.test b/mysql-test/t/type_timestamp.test
index 9b3abc9f155..a04e46081ec 100644
--- a/mysql-test/t/type_timestamp.test
+++ b/mysql-test/t/type_timestamp.test
@@ -234,3 +234,14 @@ alter table t1 add i int default 10;
select * from t1;
drop table t1;
+#
+# Test for bug #4491, TIMESTAMP(19) should be possible to create and not
+# only read in 4.0
+#
+create table t1 (ts timestamp(19));
+show create table t1;
+set TIMESTAMP=1000000000;
+insert into t1 values ();
+select * from t1;
+drop table t1;
+
diff --git a/mysql-test/t/type_uint.test b/mysql-test/t/type_uint.test
index ee5f5e8123b..b1f59242e8e 100644
--- a/mysql-test/t/type_uint.test
+++ b/mysql-test/t/type_uint.test
@@ -10,5 +10,6 @@ SET SQL_WARNINGS=1;
create table t1 (this int unsigned);
insert into t1 values (1);
insert into t1 values (-1);
+insert into t1 values ('5000000000');
select * from t1;
drop table t1;