summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-09-06 07:19:14 +0400
committerAlexander Barkov <bar@mariadb.com>2019-09-06 07:19:14 +0400
commitdb9e41ddc31f2e705a54132cf69c781e1cc60f07 (patch)
tree7c5a3d08141e7ac16cc5b58ef3b8f75f6509a8c0
parent18e10e89bb7b60dc4fb0380c46e37ea4f64cab8c (diff)
downloadmariadb-git-db9e41ddc31f2e705a54132cf69c781e1cc60f07.tar.gz
MDEV-20496 Assertion `field.is_sane()' failed in Protocol_text::store_field_metadata
-rw-r--r--mysql-test/main/type_bit.result23
-rw-r--r--mysql-test/main/type_bit.test23
-rw-r--r--sql/sql_type.h1
3 files changed, 47 insertions, 0 deletions
diff --git a/mysql-test/main/type_bit.result b/mysql-test/main/type_bit.result
index 2964f400f10..2c9b4230022 100644
--- a/mysql-test/main/type_bit.result
+++ b/mysql-test/main/type_bit.result
@@ -878,3 +878,26 @@ DROP TABLE t1;
#
# End of 10.4 tests
#
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20496 Assertion `field.is_sane()' failed in Protocol_text::store_field_metadata
+#
+CREATE TABLE t1 (b BIT(1));
+SELECT MIN(CASE WHEN 0 THEN b END) FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def MIN(CASE WHEN 0 THEN b END) 8 1 0 Y 32928 0 63
+MIN(CASE WHEN 0 THEN b END)
+NULL
+CREATE TABLE t2 AS SELECT MIN(CASE WHEN 0 THEN b END) FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `MIN(CASE WHEN 0 THEN b END)` bigint(1) unsigned DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/mysql-test/main/type_bit.test b/mysql-test/main/type_bit.test
index d0644b764ae..57bd990c8d7 100644
--- a/mysql-test/main/type_bit.test
+++ b/mysql-test/main/type_bit.test
@@ -511,3 +511,26 @@ DROP TABLE t1;
--echo #
--echo # End of 10.4 tests
--echo #
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20496 Assertion `field.is_sane()' failed in Protocol_text::store_field_metadata
+--echo #
+
+CREATE TABLE t1 (b BIT(1));
+--disable_ps_protocol
+--enable_metadata
+SELECT MIN(CASE WHEN 0 THEN b END) FROM t1;
+--disable_metadata
+--enable_ps_protocol
+CREATE TABLE t2 AS SELECT MIN(CASE WHEN 0 THEN b END) FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 753190d295b..62ba43acc81 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -5391,6 +5391,7 @@ public:
virtual ~Type_handler_bit() {}
const Name name() const override { return m_name_bit; }
enum_field_types field_type() const override { return MYSQL_TYPE_BIT; }
+ uint flags() const override { return UNSIGNED_FLAG; }
protocol_send_type_t protocol_send_type() const override
{
return PROTOCOL_SEND_STRING;