summaryrefslogtreecommitdiff
path: root/mysql-test/r/type_date.result
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-10-22 19:32:18 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2007-10-22 19:32:18 +0300
commit849bcf941fca633c66597ee9c9efac3f443b63b9 (patch)
treece0c8994df3f74e763a75f23117a711956dac0c6 /mysql-test/r/type_date.result
parent578c23860021d7eda334e42b17c90e039474587f (diff)
downloadmariadb-git-849bcf941fca633c66597ee9c9efac3f443b63b9.tar.gz
Bug #28687: Search fails on '0000-00-00' date after sql_mode change
When doing indexed search the server constructs a key image for faster comparison to the stored keys. While doing that it must not perform (and stop if they fail) the additional date checks that can be turned on by the SQL mode because there already may be values in the table that don't comply with the error checks. Fixed by ignoring these SQL mode bits while making the key image. mysql-test/r/type_date.result: Bug #28687: test case mysql-test/t/type_date.test: Bug #28687: test case sql/item.cc: Bug #28687: no invalid date warnings
Diffstat (limited to 'mysql-test/r/type_date.result')
-rw-r--r--mysql-test/r/type_date.result39
1 files changed, 39 insertions, 0 deletions
diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result
index 35239520191..bd2a43569dd 100644
--- a/mysql-test/r/type_date.result
+++ b/mysql-test/r/type_date.result
@@ -175,4 +175,43 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW();
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where
DROP TABLE t1;
+CREATE TABLE t1 (a DATE);
+CREATE TABLE t2 (a DATE);
+CREATE INDEX i ON t1 (a);
+INSERT INTO t1 VALUES ('0000-00-00'),('0000-00-00');
+INSERT INTO t2 VALUES ('0000-00-00'),('0000-00-00');
+SELECT * FROM t1 WHERE a = '0000-00-00';
+a
+0000-00-00
+0000-00-00
+SELECT * FROM t2 WHERE a = '0000-00-00';
+a
+0000-00-00
+0000-00-00
+SET SQL_MODE=TRADITIONAL;
+EXPLAIN SELECT * FROM t1 WHERE a = '0000-00-00';
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 ref i i 4 const 1 Using where; Using index
+Warnings:
+Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
+Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
+SELECT * FROM t1 WHERE a = '0000-00-00';
+a
+0000-00-00
+0000-00-00
+Warnings:
+Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
+Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
+Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
+SELECT * FROM t2 WHERE a = '0000-00-00';
+a
+0000-00-00
+0000-00-00
+Warnings:
+Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
+Warning 1292 Incorrect date value: '0000-00-00' for column 'a' at row 1
+INSERT INTO t1 VALUES ('0000-00-00');
+ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1
+SET SQL_MODE=DEFAULT;
+DROP TABLE t1,t2;
End of 5.0 tests