summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorunknown <monty@hundin.mysql.fi>2002-05-15 01:01:26 +0300
committerunknown <monty@hundin.mysql.fi>2002-05-15 01:01:26 +0300
commiteba5ec8b4bceabab302462db850882f715a7b040 (patch)
tree3dc97e13fe4695f7d461248693b9267cf1bcc638 /mysql-test
parent3051d8bbc15ef775dcb549fd00be596d61131fcf (diff)
downloadmariadb-git-eba5ec8b4bceabab302462db850882f715a7b040.tar.gz
Fixed bug in datetime range optimization
Docs/manual.texi: Changelog mysql-test/r/type_datetime.result: Test of datetime optimization mysql-test/t/type_datetime.test: Test of datetime optimization
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/type_datetime.result7
-rw-r--r--mysql-test/t/type_datetime.test20
2 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/r/type_datetime.result b/mysql-test/r/type_datetime.result
index 7028b5ffe33..dd34bc1cf86 100644
--- a/mysql-test/r/type_datetime.result
+++ b/mysql-test/r/type_datetime.result
@@ -33,3 +33,10 @@ date_format(a,"%Y-%m-%d")=b right(a,6)=c+0 a=d+0
1 1 1
a
0000-00-00 00:00:00
+date numfacture expedition
+0000-00-00 00:00:00 0 0001-00-00 00:00:00
+date numfacture expedition
+0000-00-00 00:00:00 0 0001-00-00 00:00:00
+0000-00-00 00:00:00 1212 0001-00-00 00:00:00
+table type possible_keys key key_len ref rows Extra
+t1 ref expedition expedition 8 const 1 where used
diff --git a/mysql-test/t/type_datetime.test b/mysql-test/t/type_datetime.test
index 1e7bd11bab1..626dedad547 100644
--- a/mysql-test/t/type_datetime.test
+++ b/mysql-test/t/type_datetime.test
@@ -30,3 +30,23 @@ CREATE TABLE t1 (a datetime not null);
insert into t1 values (0);
select * from t1 where a is null;
drop table t1;
+
+#
+# Test of datetime optimization
+#
+
+CREATE TABLE `t1` (
+ `date` datetime NOT NULL default '0000-00-00 00:00:00',
+ `numfacture` int(6) unsigned NOT NULL default '0',
+ `expedition` datetime NOT NULL default '0000-00-00 00:00:00',
+ PRIMARY KEY (`numfacture`),
+ KEY `date` (`date`),
+ KEY `expedition` (`expedition`)
+) TYPE=MyISAM;
+
+INSERT INTO t1 (expedition) VALUES ('0001-00-00 00:00:00');
+SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
+INSERT INTO t1 (numfacture,expedition) VALUES ('1212','0001-00-00 00:00:00');
+SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
+EXPLAIN SELECT * FROM t1 WHERE expedition='0001-00-00 00:00:00';
+drop table t1;