summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-05-21 09:28:12 +0400
committerAlexander Barkov <bar@mariadb.org>2017-05-21 09:28:12 +0400
commit8c479820da2ef10438485864a65ceb3ac750c228 (patch)
tree4eeff5cd42f456ec0330f9dc8594e5ca03f47a82 /mysql-test
parenta8caa8e04a27f7463abd4fd588a4ce1799e600c7 (diff)
downloadmariadb-git-8c479820da2ef10438485864a65ceb3ac750c228.tar.gz
MDEV-12856 Wrong .. metadata for DIV + MDEV-12857..errors on CREATE..SELECT..DIV
This is a joint patch for: MDEV-12856 Wrong result set metadata for DIV MDEV-12857 Out-of-range errors on CREATE..SELECT 2222222222 DIV 1
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/func_math.result21
-rw-r--r--mysql-test/r/metadata.result13
-rw-r--r--mysql-test/t/func_math.test16
-rw-r--r--mysql-test/t/metadata.test12
4 files changed, 62 insertions, 0 deletions
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index 931604cec7a..c681505a676 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -856,3 +856,24 @@ t1 CREATE TABLE `t1` (
`c3` double DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
+#
+# MDEV-12857 Out-of-range errors on CREATE..SELECT 2222222222 DIV 1
+#
+SET sql_mode=STRICT_ALL_TABLES;
+CREATE OR REPLACE TABLE t1 AS SELECT
+2 DIV 1 AS d01,
+222222222 DIV 1 AS d09,
+2222222222 DIV 1 AS d10;
+SHOW CREATE TABLE t1;
+Table Create Table
+t1 CREATE TABLE `t1` (
+ `d01` int(1) DEFAULT NULL,
+ `d09` int(9) DEFAULT NULL,
+ `d10` bigint(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+d01 2
+d09 222222222
+d10 2222222222
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
diff --git a/mysql-test/r/metadata.result b/mysql-test/r/metadata.result
index bebd97610d4..c378a48ee56 100644
--- a/mysql-test/r/metadata.result
+++ b/mysql-test/r/metadata.result
@@ -536,3 +536,16 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is
def TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01') 8 21 1 Y 32896 0 63
TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01')
3
+#
+# MDEV-12856 Wrong result set metadata for DIV
+#
+SELECT
+2 DIV 1 AS d0l,
+222222222 DIV 1 AS d09,
+2222222222 DIV 1 AS d10;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def d0l 3 1 1 Y 32896 0 63
+def d09 3 9 9 Y 32896 0 63
+def d10 8 10 10 Y 32896 0 63
+d0l d09 d10
+2 222222222 2222222222
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 03e9923bc52..fd000211145 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -624,3 +624,19 @@ CREATE OR REPLACE TABLE t1 AS SELECT
ROUND(10e0,NULL) AS c3;
SHOW CREATE TABLE t1;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-12857 Out-of-range errors on CREATE..SELECT 2222222222 DIV 1
+--echo #
+
+SET sql_mode=STRICT_ALL_TABLES;
+CREATE OR REPLACE TABLE t1 AS SELECT
+ 2 DIV 1 AS d01,
+ 222222222 DIV 1 AS d09,
+ 2222222222 DIV 1 AS d10;
+SHOW CREATE TABLE t1;
+--vertical_results
+SELECT * FROM t1;
+--horizontal_results
+DROP TABLE t1;
+SET sql_mode=DEFAULT;
diff --git a/mysql-test/t/metadata.test b/mysql-test/t/metadata.test
index 0bd1b98c07d..7c50dadea0b 100644
--- a/mysql-test/t/metadata.test
+++ b/mysql-test/t/metadata.test
@@ -326,3 +326,15 @@ SELECT LAST_INSERT_ID();
SELECT ROW_COUNT(), FOUND_ROWS();
SELECT TIMESTAMPDIFF(MONTH,'2003-02-01','2003-05-01');
--disable_metadata
+
+
+--echo #
+--echo # MDEV-12856 Wrong result set metadata for DIV
+--echo #
+
+--enable_metadata
+SELECT
+ 2 DIV 1 AS d0l,
+ 222222222 DIV 1 AS d09,
+ 2222222222 DIV 1 AS d10;
+--disable_metadata