1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
drop table if exists t1;
SET SQL_WARNINGS=1;
create table t1 (this int unsigned);
insert into t1 values (1);
insert into t1 values (-1);
Warnings:
Warning 1264 Out of range value for column 'this' at row 1
insert into t1 values ('5000000000');
Warnings:
Warning 1264 Out of range value for column 'this' at row 1
select * from t1;
this
1
0
4294967295
drop table t1;
#
# Start of 10.0 tests
#
#
# MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns
#
CREATE TABLE t1 (a DATE PRIMARY KEY);
INSERT INTO t1 VALUES ('1999-01-01');
CREATE TABLE t2 (a INT UNSIGNED);
INSERT INTO t2 VALUES (19990101);
INSERT INTO t2 VALUES (990101);
SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
a
1999-01-01
1999-01-01
SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
a
1999-01-01
1999-01-01
ALTER TABLE t2 ADD PRIMARY KEY(a);
SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
a
1999-01-01
1999-01-01
SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
a
1999-01-01
1999-01-01
# t2 should NOT be eliminated
EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 system NULL NULL NULL NULL 1
1 SIMPLE t2 index PRIMARY PRIMARY 4 NULL 2 Using where; Using index
DROP TABLE t1,t2;
#
# End of 10.0 tests
#
|