summaryrefslogtreecommitdiff
path: root/mysql-test/main/type_uint.result
blob: ef7a7ed98cae3c4f7a20aa4d658d0c75a7439942 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
drop table if exists t1;
SET SQL_WARNINGS=1;
create table t1 (this int unsigned);
insert into t1 values (1);
insert ignore into t1 values (-1);
Warnings:
Warning	1264	Out of range value for column 'this' at row 1
insert ignore 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;
create table t1 (a bigint unsigned, b mediumint unsigned);
insert t1 values (1,2),(0xffffffffffffffff,0xffffff);
select coalesce(a,b), coalesce(b,a) from t1;
coalesce(a,b)	coalesce(b,a)
1	2
18446744073709551615	16777215
create table t2 as select a from t1 union select b from t1;
show create table t2;
Table	Create Table
t2	CREATE TABLE `t2` (
  `a` bigint(20) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select * from t2;
a
1
18446744073709551615
2
16777215
drop table t1, t2;
#
# 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
#