summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-03-06 23:41:18 +0200
committerunknown <monty@hundin.mysql.fi>2002-03-06 23:41:18 +0200
commit873963d4cacbceca05881b4adc6dbbae6c64e0d9 (patch)
tree8004cb532c51b6a2c9f603271702236358f167cb /mysql-test
parente578a2e23142b863db9c95ebe1d3459c84cfabfe (diff)
parent4d710469be9b534825fee784c8cdaba7bbe6f626 (diff)
downloadmariadb-git-873963d4cacbceca05881b4adc6dbbae6c64e0d9.tar.gz
merge
BitKeeper/etc/logging_ok: auto-union Build-tools/Do-all-build-steps: Auto merged Build-tools/Do-compile: Auto merged Build-tools/Do-rpm: Auto merged Docs/manual.texi: Auto merged include/hash.h: Auto merged include/my_sys.h: Auto merged innobase/dict/dict0dict.c: Auto merged mysql-test/mysql-test-run.sh: Auto merged mysys/array.c: Auto merged mysys/hash.c: Auto merged mysys/mf_qsort.c: Auto merged sql/sql_base.cc: Auto merged sql/sql_select.cc: Auto merged sql/table.cc: Auto merged strings/Makefile.am: Auto merged support-files/mysql.spec.sh: Auto merged
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/mysql-test-run.sh11
-rw-r--r--mysql-test/r/distinct.result15
-rw-r--r--mysql-test/r/group_by.result4
-rw-r--r--mysql-test/r/having.result19
-rw-r--r--mysql-test/t/distinct.test11
-rw-r--r--mysql-test/t/having.test12
-rw-r--r--mysql-test/t/type_date.test13
7 files changed, 78 insertions, 7 deletions
diff --git a/mysql-test/mysql-test-run.sh b/mysql-test/mysql-test-run.sh
index a017cf5a97e..efebc5b5c86 100644
--- a/mysql-test/mysql-test-run.sh
+++ b/mysql-test/mysql-test-run.sh
@@ -79,8 +79,10 @@ sleep_until_file_created ()
# No paths below as we can't be sure where the program is!
-BASENAME=`which basename | head -1`
-DIFF=`which diff | head -1`
+SED=sed
+
+BASENAME=`which basename | $SED q`
+DIFF=`which diff | $SED q`
CAT=cat
CUT=cut
HEAD=head
@@ -88,13 +90,12 @@ TAIL=tail
ECHO=echo # use internal echo if possible
EXPR=expr # use internal if possible
FIND=find
-GCOV=`which gcov | head -1`
+GCOV=`which gcov | $SED q`
PRINTF=printf
RM=rm
TIME=time
TR=tr
-XARGS=`which xargs | head -1`
-SED=sed
+XARGS=`which xargs | $SED q`
# Are we using a source or a binary distribution?
diff --git a/mysql-test/r/distinct.result b/mysql-test/r/distinct.result
index 21f87a11a53..e347a95b037 100644
--- a/mysql-test/r/distinct.result
+++ b/mysql-test/r/distinct.result
@@ -77,6 +77,7 @@ NULL NULL
10 VMT
select id+0 as a,max(id),concat(facility) as b from t1 group by a order by b desc,a;
a max(id) b
+NULL NULL NULL
10 10 VMT
9 9 SRV
8 8 RV
@@ -89,7 +90,6 @@ a max(id) b
1 1 /L
-1 -1
0 0
-NULL NULL NULL
select id >= 0 and id <= 5 as grp,count(*) from t1 group by grp;
grp count(*)
0 7
@@ -336,3 +336,16 @@ a c
4 NULL
3 NULL
drop table t1;
+create table t1 (a char(1), key(a)) type=myisam;
+insert into t1 values('1'),('1');
+select * from t1 where a >= '1';
+a
+1
+1
+select distinct a from t1 order by a desc;
+a
+1
+select distinct a from t1 where a >= '1' order by a desc;
+a
+1
+drop table t1;
diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result
index 9845e12ef5f..2affdc1b653 100644
--- a/mysql-test/r/group_by.result
+++ b/mysql-test/r/group_by.result
@@ -226,7 +226,7 @@ key (score)
INSERT INTO t1 VALUES (1,1,1),(2,2,2),(2,1,1),(3,3,3),(4,3,3),(5,3,3);
explain select userid,count(*) from t1 group by userid desc;
table type possible_keys key key_len ref rows Extra
-t1 ALL NULL NULL NULL NULL 6 Using temporary
+t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort
select userid,count(*) from t1 group by userid desc;
userid count(*)
3 3
@@ -244,6 +244,8 @@ spid count(*)
2 2
select spid,count(*) from t1 where spid between 1 and 2 group by spid desc;
spid count(*)
+2 2
+1 1
explain select sql_big_result spid,sum(userid) from t1 group by spid desc;
table type possible_keys key key_len ref rows Extra
t1 ALL NULL NULL NULL NULL 6 Using filesort
diff --git a/mysql-test/r/having.result b/mysql-test/r/having.result
index df99f2545cb..a33ce457176 100644
--- a/mysql-test/r/having.result
+++ b/mysql-test/r/having.result
@@ -44,3 +44,22 @@ AND start <= 999660;
id start end chr_strand
133197 813898 813898 -1.0000
drop table t1,t2;
+CREATE TABLE t1 (Fld1 int(11) default NULL,Fld2 int(11) default NULL);
+INSERT INTO t1 VALUES (1,10),(1,20),(2,NULL),(2,NULL),(3,50);
+select Fld1, max(Fld2) as q from t1 group by Fld1 having q is not null;
+Fld1 q
+1 20
+3 50
+select Fld1, max(Fld2) from t1 group by Fld1 having max(Fld2) is not null;
+Fld1 max(Fld2)
+1 20
+3 50
+select Fld1, max(Fld2) from t1 group by Fld1 having avg(Fld2) is not null;
+Fld1 max(Fld2)
+1 20
+3 50
+select Fld1, max(Fld2) from t1 group by Fld1 having std(Fld2) is not null;
+Fld1 max(Fld2)
+1 20
+3 50
+drop table t1;
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test
index bf8a03ac40d..b850ec5d562 100644
--- a/mysql-test/t/distinct.test
+++ b/mysql-test/t/distinct.test
@@ -207,3 +207,14 @@ insert into t1 (a) values (1),(2),(3),(4),(1),(2),(3),(4);
select distinct a from t1 group by b,a having a > 2 order by a desc;
select distinct a,c from t1 group by b,c,a having a > 2 order by a desc;
drop table t1;
+
+#
+# Test problem with DISTINCT and ORDER BY DESC
+#
+
+create table t1 (a char(1), key(a)) type=myisam;
+insert into t1 values('1'),('1');
+select * from t1 where a >= '1';
+select distinct a from t1 order by a desc;
+select distinct a from t1 where a >= '1' order by a desc;
+drop table t1;
diff --git a/mysql-test/t/having.test b/mysql-test/t/having.test
index fff5415976c..8dd7606d82b 100644
--- a/mysql-test/t/having.test
+++ b/mysql-test/t/having.test
@@ -48,3 +48,15 @@ GROUP BY e.id
HAVING chr_strand= -1 and end >= 0
AND start <= 999660;
drop table t1,t2;
+
+#
+# Test problem with having and MAX() IS NOT NULL
+#
+
+CREATE TABLE t1 (Fld1 int(11) default NULL,Fld2 int(11) default NULL);
+INSERT INTO t1 VALUES (1,10),(1,20),(2,NULL),(2,NULL),(3,50);
+select Fld1, max(Fld2) as q from t1 group by Fld1 having q is not null;
+select Fld1, max(Fld2) from t1 group by Fld1 having max(Fld2) is not null;
+select Fld1, max(Fld2) from t1 group by Fld1 having avg(Fld2) is not null;
+select Fld1, max(Fld2) from t1 group by Fld1 having std(Fld2) is not null;
+drop table t1;
diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test
index 0d2e18bcc94..68c2d55aac9 100644
--- a/mysql-test/t/type_date.test
+++ b/mysql-test/t/type_date.test
@@ -62,3 +62,16 @@ create table t1 (date date);
insert into t1 values ("2000-08-10"),("2000-08-11");
select date_add(date,INTERVAL 1 DAY),date_add(date,INTERVAL 1 SECOND) from t1;
drop table t1;
+
+#
+# Test problem with DATE_FORMAT
+#
+
+CREATE TABLE t1(AFIELD INT);
+INSERT INTO t1 VALUES(1);
+CREATE TABLE t2(GMT VARCHAR(32));
+INSERT INTO t2 VALUES('GMT-0800');
+SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1, t2 GROUP BY t1.AFIELD;
+INSERT INTO t1 VALUES(1);
+SELECT DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)), DATE_FORMAT("2002-03-06 10:11:12", CONCAT('%a, %d %M %Y %H:%i:%s ' , t2.GMT)) FROM t1,t2 GROUP BY t1.AFIELD;
+drop table t1,t2;