summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorgluh@eagle.(none) <>2007-12-13 16:10:57 +0400
committergluh@eagle.(none) <>2007-12-13 16:10:57 +0400
commitd504588e7948b1f8ed815a78aeb263471a1b6635 (patch)
tree2c8c40e7d9d218e840756bed5ba5cbd07e40d13b /mysql-test
parent4f5868114a1fe46f139f80d894dd28f1f7c180c1 (diff)
parent9df070ed7c0f2877e71572e59aec871f4bc039fd (diff)
downloadmariadb-git-d504588e7948b1f8ed815a78aeb263471a1b6635.tar.gz
Merge mysql.com:/home/gluh/MySQL/Merge/5.0-opt
into mysql.com:/home/gluh/MySQL/Merge/5.1-opt
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/include/mix1.inc13
-rw-r--r--mysql-test/r/delayed.result16
-rw-r--r--mysql-test/r/func_misc.result5
-rw-r--r--mysql-test/r/innodb_mysql.result12
-rw-r--r--mysql-test/r/range.result18
-rw-r--r--mysql-test/t/func_misc.test14
-rw-r--r--mysql-test/t/range.test20
7 files changed, 82 insertions, 16 deletions
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
index e695e7d5570..3005e67935b 100644
--- a/mysql-test/include/mix1.inc
+++ b/mysql-test/include/mix1.inc
@@ -724,6 +724,19 @@ set @@sort_buffer_size=default;
DROP TABLE t1,t2;
#
+# Bug #32815: query with ORDER BY and a possible ref_or_null access
+#
+
+CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+ (191, 'member', 1), (NULL, 'member', 3), (NULL, 'member', 4), (201, 'member', 2);
+
+EXPLAIN SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
+SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
+
+DROP TABLE t1;
+
+
# Test of behaviour with CREATE ... SELECT
#
diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result
index f6dde6b4060..bcda6ddb6ab 100644
--- a/mysql-test/r/delayed.result
+++ b/mysql-test/r/delayed.result
@@ -109,20 +109,12 @@ c1
DROP TABLE t1;
SET @@auto_increment_offset=
@bug20627_old_auto_increment_offset;
-Warnings:
-Warning 1292 Truncated incorrect auto-increment-offset value: '0'
SET @@auto_increment_increment=
@bug20627_old_auto_increment_increment;
-Warnings:
-Warning 1292 Truncated incorrect auto-increment-increment value: '0'
SET @@session.auto_increment_offset=
@bug20627_old_session_auto_increment_offset;
-Warnings:
-Warning 1292 Truncated incorrect auto-increment-offset value: '0'
SET @@session.auto_increment_increment=
@bug20627_old_session_auto_increment_increment;
-Warnings:
-Warning 1292 Truncated incorrect auto-increment-increment value: '0'
SET @bug20830_old_auto_increment_offset=
@@auto_increment_offset;
SET @bug20830_old_auto_increment_increment=
@@ -245,20 +237,12 @@ SUM(c1)
DROP TABLE t1;
SET @@auto_increment_offset=
@bug20830_old_auto_increment_offset;
-Warnings:
-Warning 1292 Truncated incorrect auto-increment-offset value: '0'
SET @@auto_increment_increment=
@bug20830_old_auto_increment_increment;
-Warnings:
-Warning 1292 Truncated incorrect auto-increment-increment value: '0'
SET @@session.auto_increment_offset=
@bug20830_old_session_auto_increment_offset;
-Warnings:
-Warning 1292 Truncated incorrect auto-increment-offset value: '0'
SET @@session.auto_increment_increment=
@bug20830_old_session_auto_increment_increment;
-Warnings:
-Warning 1292 Truncated incorrect auto-increment-increment value: '0'
CREATE TABLE t1(a BIT);
INSERT DELAYED INTO t1 VALUES(1);
FLUSH TABLE t1;
diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result
index eb0f2553cb0..745a340ec94 100644
--- a/mysql-test/r/func_misc.result
+++ b/mysql-test/r/func_misc.result
@@ -212,6 +212,11 @@ test
SELECT NAME_CONST('test', 'test');
test
test
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (5), (2);
+SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
+ERROR HY000: Incorrect arguments to NAME_CONST
+DROP TABLE t1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (), (), ();
SELECT NAME_CONST(a, '1') FROM t1;
diff --git a/mysql-test/r/innodb_mysql.result b/mysql-test/r/innodb_mysql.result
index 469c030596b..87cf1acc10c 100644
--- a/mysql-test/r/innodb_mysql.result
+++ b/mysql-test/r/innodb_mysql.result
@@ -1344,6 +1344,18 @@ t1 CREATE TABLE `t1` (
UNIQUE KEY `aa` (`a`(1))
) ENGINE=InnoDB DEFAULT CHARSET=latin1
drop table t1;
+CREATE TABLE t1 (id int, type char(6), d int, INDEX idx(id,d)) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(191, 'member', 1), (NULL, 'member', 3), (NULL, 'member', 4), (201, 'member', 2);
+EXPLAIN SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ALL idx NULL NULL NULL 3 Using where; Using filesort
+SELECT * FROM t1 WHERE id=191 OR id IS NULL ORDER BY d;
+id type d
+191 member 1
+NULL member 3
+NULL member 4
+DROP TABLE t1;
End of 5.0 tests
CREATE TABLE `t2` (
`k` int(11) NOT NULL auto_increment,
diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result
index 108264b3bf2..005969c7f18 100644
--- a/mysql-test/r/range.result
+++ b/mysql-test/r/range.result
@@ -1149,3 +1149,21 @@ explain select * from t2 where a=1000 and b<11;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref a a 5 const 502 Using where
drop table t1, t2;
+
+BUG#32198 "Comparison of DATE with DATETIME still not using indexes correctly"
+
+CREATE TABLE t1 (
+id int(11) NOT NULL auto_increment,
+dateval date default NULL,
+PRIMARY KEY (id),
+KEY dateval (dateval)
+) AUTO_INCREMENT=173;
+INSERT INTO t1 VALUES
+(1,'2007-01-01'),(2,'2007-01-02'),(3,'2007-01-03'),(4,'2007-01-04'),
+(5,'2007-01-05'),(6,'2007-01-06'),(7,'2007-01-07'),(8,'2007-01-08'),
+(9,'2007-01-09'),(10,'2007-01-10'),(11,'2007-01-11');
+This must use range access:
+explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 range dateval dateval 4 NULL 2 Using where
+drop table t1;
diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test
index 5a934ce712e..7a579088d23 100644
--- a/mysql-test/t/func_misc.test
+++ b/mysql-test/t/func_misc.test
@@ -214,6 +214,20 @@ SELECT NAME_CONST('test', -1.0);
SELECT NAME_CONST('test', 'test');
#
+# Bug #27545: erroneous usage of NAME_CONST with a name as the first parameter
+# resolved against a column name of a derived table hangs the client
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (5), (2);
+
+--error ER_WRONG_ARGUMENTS
+SELECT NAME_CONST(x,2) FROM (SELECT a x FROM t1) t;
+
+DROP TABLE t1;
+
+
+#
# Bug #32559: connection hangs on query with name_const
#
CREATE TABLE t1(a INT);
diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test
index 06c2ef248c4..e20f0370e2c 100644
--- a/mysql-test/t/range.test
+++ b/mysql-test/t/range.test
@@ -935,6 +935,26 @@ SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00';
DROP TABLE t1;
+--echo
+--echo BUG#32198 "Comparison of DATE with DATETIME still not using indexes correctly"
+--echo
+CREATE TABLE t1 (
+ id int(11) NOT NULL auto_increment,
+ dateval date default NULL,
+ PRIMARY KEY (id),
+ KEY dateval (dateval)
+) AUTO_INCREMENT=173;
+
+INSERT INTO t1 VALUES
+(1,'2007-01-01'),(2,'2007-01-02'),(3,'2007-01-03'),(4,'2007-01-04'),
+(5,'2007-01-05'),(6,'2007-01-06'),(7,'2007-01-07'),(8,'2007-01-08'),
+(9,'2007-01-09'),(10,'2007-01-10'),(11,'2007-01-11');
+
+--echo This must use range access:
+explain select * from t1 where dateval >= '2007-01-01 00:00:00' and dateval <= '2007-01-02 23:59:59';
+
+drop table t1;
+
# End of 5.0 tests
# BUG#22393 fix: Adjust 'ref' estimate if we have 'range' estimate for