summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-11-07 12:57:11 +0400
committerAlexander Barkov <bar@mariadb.org>2017-11-07 12:57:11 +0400
commitc09f22bab535bccc1687a3b06e03dbaf4fc3ae46 (patch)
tree7a6a4a64c9392b261665c0c82493f9235fd56090
parent120f848f75ccbfb4f7aa1db3b0ac5dca8028a7d9 (diff)
downloadmariadb-git-c09f22bab535bccc1687a3b06e03dbaf4fc3ae46.tar.gz
MDEV-8867 Wrong field type or metadata for COALESCE(bit_column, 1)
This problem was earlier fixed by the patch for MDEV-8910. Adding tests only.
-rw-r--r--mysql-test/r/type_bit.result24
-rw-r--r--mysql-test/t/type_bit.test19
2 files changed, 43 insertions, 0 deletions
diff --git a/mysql-test/r/type_bit.result b/mysql-test/r/type_bit.result
index 639a97be27b..4136eb4dff7 100644
--- a/mysql-test/r/type_bit.result
+++ b/mysql-test/r/type_bit.result
@@ -806,3 +806,27 @@ SUM(a)
NULL
DROP TABLE t1;
End of 5.1 tests
+#
+# Start of 10.1 tests
+#
+#
+# MDEV-8867 Wrong field type or metadata for COALESCE(bit_column, 1)
+#
+CREATE TABLE t1 (val bit(1));
+INSERT INTO t1 VALUES (0);
+CREATE TABLE t2 AS SELECT COALESCE(val, 1) AS c FROM t1;
+SELECT * FROM t2;
+c
+0
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `c` decimal(1,0) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+SELECT COALESCE(val, 1) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def COALESCE(val, 1) 246 2 1 Y 32896 0 63
+COALESCE(val, 1)
+0
+DROP TABLE t1;
diff --git a/mysql-test/t/type_bit.test b/mysql-test/t/type_bit.test
index 2ca608e76ff..01a610999bd 100644
--- a/mysql-test/t/type_bit.test
+++ b/mysql-test/t/type_bit.test
@@ -439,3 +439,22 @@ SELECT SUM(a) FROM t1 GROUP BY c, b, a;
DROP TABLE t1;
--echo End of 5.1 tests
+
+--echo #
+--echo # Start of 10.1 tests
+--echo #
+
+--echo #
+--echo # MDEV-8867 Wrong field type or metadata for COALESCE(bit_column, 1)
+--echo #
+
+CREATE TABLE t1 (val bit(1));
+INSERT INTO t1 VALUES (0);
+CREATE TABLE t2 AS SELECT COALESCE(val, 1) AS c FROM t1;
+SELECT * FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+--enable_metadata
+SELECT COALESCE(val, 1) FROM t1;
+--disable_metadata
+DROP TABLE t1;