diff options
Diffstat (limited to 'mysql-test/t/distinct.test')
-rw-r--r-- | mysql-test/t/distinct.test | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/mysql-test/t/distinct.test b/mysql-test/t/distinct.test index 84073d15109..a7eefad5ca5 100644 --- a/mysql-test/t/distinct.test +++ b/mysql-test/t/distinct.test @@ -615,6 +615,42 @@ SET @@max_heap_table_size = @old_max_heap_table_size; --echo End of 5.1 tests +# +# test_if_equality_guarantees_uniqueness() and dates +# +create table t1 (a varchar(100)); +insert t1 values ('2010-10-10'), ('20101010'); +select * from t1 where a = DATE('2010-10-10'); +select distinct a from t1 where a = DATE('2010-10-10'); +explain select distinct a from t1 where a = DATE('2010-10-10'); +drop table t1; +# +# test_if_equality_guarantees_uniqueness() and different type combinations +# +--echo # date = string +create table t1 (a date); +insert t1 values ('2010-10-10'), ('20101010'); +explain select distinct a from t1 where a = '2010-10-10'; +drop table t1; +--echo # double = string +create table t1 (a double); +insert t1 values (2), (2); +explain select distinct a from t1 where a = '2'; +--echo # double = int +explain select distinct a from t1 where a = 2; +--echo # string = double +alter table t1 modify a varchar(100); +explain select distinct a from t1 where a = 2e0; +drop table t1; + +# +# lp:731124 Loss of precision on DISTINCT +# +create table t1 (f1 varchar(40)); +insert into t1 values ('2010-10-10 00:00:00.0001'),('2010-10-10 00:00:00.0002'),('2010-10-10 00:00:00.0003'); +select time(f1) from t1 ; +select distinct time(f1) from t1 ; +drop table t1; --echo # --echo # Bug #11744875: 4082: integer lengths cause truncation with distinct concat and innodb @@ -625,5 +661,4 @@ INSERT INTO t1 VALUES (1111, 2222), (3333, 4444); SELECT DISTINCT CONCAT(a,b) AS c FROM t1 ORDER BY 1; DROP TABLE t1; - --echo End of 5.5 tests |