summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorunknown <monty@mysql.com>2005-02-03 13:18:30 +0200
committerunknown <monty@mysql.com>2005-02-03 13:18:30 +0200
commit4f1cbb6031d8310f17db9e503234ef169805412a (patch)
treee52c0cca0b1936bb8b6332b6f0e724b9666f65f1 /mysql-test/t
parent9240144b739dda5b1221b880f9bade0f774697e6 (diff)
parentad21db5e0727704ee0527c08410bafff4d3150f4 (diff)
downloadmariadb-git-4f1cbb6031d8310f17db9e503234ef169805412a.tar.gz
4.1 -> 5.0 merge
BitKeeper/etc/logging_ok: auto-union Build-tools/Do-compile: Auto merged client/mysqladmin.cc: Auto merged client/mysqldump.c: Auto merged configure.in: Auto merged extra/perror.c: Auto merged innobase/buf/buf0rea.c: Auto merged innobase/fil/fil0fil.c: Auto merged innobase/include/rem0rec.ic: Auto merged innobase/include/univ.i: Auto merged innobase/os/os0file.c: Auto merged innobase/ut/ut0ut.c: Auto merged mysql-test/r/derived.result: Auto merged mysql-test/r/func_str.result: Simple merge mysql-test/r/subselect.result: Automatic merge mysql-test/t/derived.test: Automatic merge mysql-test/t/func_str.test: Simple merge mysql-test/t/subselect.test: Automatic merge mysys/my_handler.c: Automatic merge ndb/src/kernel/blocks/backup/Backup.cpp: Automatic merge scripts/make_binary_distribution.sh: Automatic merge scripts/mysql_install_db.sh: Automatic merge sql/examples/ha_archive.cc: Simple merge sql/ha_innodb.cc: Automatic merge sql/item.cc: Merge sql/item_cmpfunc.h: Automatic merge sql/item_func.cc: Simple merge sql/item_func.h: Automatic merge sql/item_strfunc.cc: Automatic merge sql/item_strfunc.h: Automatic merge sql/item_subselect.cc: Automatic merge sql/mysqld.cc: Automatic merge sql/set_var.cc: Automatic merge sql/sql_base.cc: Automatic merge sql/sql_class.cc: Automatic merge sql/sql_class.h: Automatic merge sql/sql_lex.cc: Automatic merge sql/sql_lex.h: Automatic merge sql/sql_parse.cc: Automatic merge sql/sql_select.cc: Automatic merge sql/sql_table.cc: Automatic merge sql/sql_update.cc: Simple merge strings/ctype-big5.c: Automatic merge strings/ctype-bin.c: Automatic merge strings/ctype-gbk.c: Automatic merge strings/ctype-latin1.c: Automatic merge strings/ctype-mb.c: Automatic merge strings/ctype-simple.c: Automatic merge strings/ctype-sjis.c: Automatic merge strings/ctype-tis620.c: Automatic merge strings/ctype-ucs2.c: Automatic merge strings/ctype-utf8.c: Automatic merge vio/viosocket.c: Automatic merge vio/viossl.c: Automatic merge
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/compare.test2
-rw-r--r--mysql-test/t/derived.test10
-rw-r--r--mysql-test/t/func_str.test45
-rw-r--r--mysql-test/t/subselect.test56
4 files changed, 107 insertions, 6 deletions
diff --git a/mysql-test/t/compare.test b/mysql-test/t/compare.test
index e3c042e608a..bc20786227b 100644
--- a/mysql-test/t/compare.test
+++ b/mysql-test/t/compare.test
@@ -33,3 +33,5 @@ DROP TABLE t1;
# Bug #8134: Comparison against CHAR(31) at end of string
SELECT CHAR(31) = '', '' = CHAR(31);
+# Extra test
+SELECT CHAR(30) = '', '' = CHAR(30);
diff --git a/mysql-test/t/derived.test b/mysql-test/t/derived.test
index 928d79ab15b..df860d92b38 100644
--- a/mysql-test/t/derived.test
+++ b/mysql-test/t/derived.test
@@ -215,6 +215,16 @@ SELECT MIN(price) min, MAX(price) max, AVG(price) avg FROM (SELECT SUBSTRING( MA
DROP TABLE t1;
#
+# DISTINCT over grouped select on subquery in the FROM clause
+#
+create table t1 (a integer, b integer);
+insert into t1 values (1,4), (2,2),(2,2), (4,1),(4,1),(4,1),(4,1);
+select distinct sum(b) from t1 group by a;
+select distinct sum(b) from (select a,b from t1) y group by a;
+drop table t1;
+
+
+#
# Test for bug #7413 "Subquery with non-scalar results participating in
# select list of derived table crashes server" aka "VIEW with sub query can
# cause the MySQL server to crash". If we have encountered problem during
diff --git a/mysql-test/t/func_str.test b/mysql-test/t/func_str.test
index 4a1b8470ada..ffbcc1d774b 100644
--- a/mysql-test/t/func_str.test
+++ b/mysql-test/t/func_str.test
@@ -196,6 +196,18 @@ select trim(trailing 'foo' from 'foo');
select trim(leading 'foo' from 'foo');
#
+# crashing bug with QUOTE() and LTRIM() or TRIM() fixed
+# Bug #7495
+#
+
+select quote(ltrim(concat(' ', 'a')));
+select quote(trim(concat(' ', 'a')));
+
+# Bad results from QUOTE(). Bug #8248
+CREATE TABLE t1 SELECT 1 UNION SELECT 2 UNION SELECT 3;
+SELECT QUOTE('A') FROM t1;
+DROP TABLE t1;
+
# Test collation and coercibility
#
@@ -430,12 +442,6 @@ create table t1 (a int not null primary key, b varchar(40), c datetime);
insert into t1 (a,b,c) values (1,'Tom','2004-12-10 12:13:14'),(2,'ball games','2004-12-10 12:13:14'), (3,'Basil','2004-12-10 12:13:14'), (4,'Dean','2004-12-10 12:13:14'),(5,'Ellis','2004-12-10 12:13:14'), (6,'Serg','2004-12-10 12:13:14'), (7,'Sergei','2004-12-10 12:13:14'),(8,'Georg','2004-12-10 12:13:14'),(9,'Salle','2004-12-10 12:13:14'),(10,'Sinisa','2004-12-10 12:13:14');
select count(*) as total, left(c,10) as reg from t1 group by reg order by reg desc limit 0,12;
drop table t1;
-# crashing bug with QUOTE() and LTRIM() or TRIM() fixed
-# Bug #7495
-#
-
-select quote(ltrim(concat(' ', 'a')));
-select quote(trim(concat(' ', 'a')));
#
# Bug#7455 unexpected result: TRIM(<NULL> FROM <whatever>) gives NOT NULL
@@ -446,3 +452,30 @@ select trim(null from 'kate') as "must_be_null";
select trim('xyz' from null) as "must_be_null";
select trim(leading NULL from 'kate') as "must_be_null";
select trim(trailing NULL from 'xyz') as "must_be_null";
+
+#
+# Bug #7751 - conversion for a bigint unsigned constant
+#
+
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ a bigint(20) unsigned default NULL,
+ PRIMARY KEY (id)
+) ENGINE=MyISAM;
+
+INSERT INTO t1 VALUES
+('0','16307858876001849059');
+
+SELECT CONV('e251273eb74a8ee3', 16, 10);
+
+EXPLAIN
+SELECT id
+ FROM t1
+ WHERE a = 16307858876001849059;
+
+EXPLAIN
+ SELECT id
+ FROM t1
+ WHERE a = CONV('e251273eb74a8ee3', 16, 10);
+
+DROP TABLE t1;
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 244802d4d6e..08d77941dfe 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1419,8 +1419,11 @@ SELECT f1 FROM t1
WHERE f1 <> ALL ( SELECT SUM(f1) AS sf1 FROM t2 HAVING sf1 > 10000);
drop table t1,t2;
+
+#
# Test for BUG#7885: Server crash when 'any' subselect compared to
# non-existant field.
+#
create table t1 (a1 int);
create table t2 (b1 int);
--error 1054
@@ -1428,3 +1431,56 @@ select * from t1 where a2 > any(select b1 from t2);
select * from t1 where a1 > any(select b1 from t2);
drop table t1,t2;
+
+#
+# Comparison subquery with * and row
+#
+create table t1 (a integer, b integer);
+select (select * from t1) = (select 1,2);
+select (select 1,2) = (select * from t1);
+# queries whih can be converted to IN
+select row(1,2) = ANY (select * from t1);
+select row(1,2) != ALL (select * from t1);
+drop table t1;
+
+#
+# Comparison subquery and row with nested rows
+#
+create table t1 (a integer, b integer);
+-- error 1241
+select row(1,(2,2)) in (select * from t1 );
+-- error 1241
+select row(1,(2,2)) = (select * from t1 );
+-- error 1241
+select (select * from t1) = row(1,(2,2));
+drop table t1;
+
+#
+# Forward reference detection
+#
+create table t1 (a integer);
+insert into t1 values (1);
+-- error 1247
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx ;
+-- error 1247
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+select 1 as xx, 1 = ALL ( select 1 from t1 where 1 = xx );
+-- error 1247
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx;
+-- error 1247
+select 1 = ALL (select 1 from t1 where 1 = xx ), 1 as xx from DUAL;
+drop table t1;
+
+#
+# cleaning up of results of subselects (BUG#8125)
+#
+CREATE TABLE `t1` ( `a` char(3) NOT NULL default '', `b` char(3) NOT NULL default '', `c` char(3) NOT NULL default '', PRIMARY KEY (`a`,`b`,`c`)) ENGINE=InnoDB;
+CREATE TABLE t2 LIKE t1;
+INSERT INTO t1 VALUES (1,1,1);
+INSERT INTO t2 VALUES (1,1,1);
+PREPARE my_stmt FROM "SELECT t1.b, count(*) FROM t1 group by t1.b having
+count(*) > ALL (SELECT COUNT(*) FROM t2 WHERE t2.a=1 GROUP By t2.b)";
+EXECUTE my_stmt;
+EXECUTE my_stmt;
+deallocate prepare my_stmt;
+drop table t1,t2;