Commit c09f22ba authored by Alexander Barkov's avatar Alexander Barkov

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.
parent 120f848f
......@@ -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;
......@@ -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;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment