summaryrefslogtreecommitdiff
path: root/mysql-test/main/type_uint.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/type_uint.test')
-rw-r--r--mysql-test/main/type_uint.test50
1 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/main/type_uint.test b/mysql-test/main/type_uint.test
new file mode 100644
index 00000000000..ae48b30997a
--- /dev/null
+++ b/mysql-test/main/type_uint.test
@@ -0,0 +1,50 @@
+#
+# test of unsigned int
+#
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+SET SQL_WARNINGS=1;
+
+create table t1 (this int unsigned);
+insert into t1 values (1);
+insert ignore into t1 values (-1);
+insert ignore into t1 values ('5000000000');
+select * from t1;
+drop table t1;
+
+# End of 4.1 tests
+
+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;
+create table t2 as select a from t1 union select b from t1;
+show create table t2;
+select * from t2;
+drop table t1, t2;
+
+--echo #
+--echo # Start of 10.0 tests
+--echo #
+
+--echo #
+--echo # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns
+--echo #
+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;
+SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
+ALTER TABLE t2 ADD PRIMARY KEY(a);
+SELECT t1.* FROM t1,t2 WHERE t1.a=t2.a;
+SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
+--echo # t2 should NOT be eliminated
+EXPLAIN SELECT t1.* FROM t1 LEFT JOIN t2 ON t1.a=t2.a;
+DROP TABLE t1,t2;
+
+--echo #
+--echo # End of 10.0 tests
+--echo #