summaryrefslogtreecommitdiff
path: root/plugin/type_inet/mysql-test/type_inet
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-10-14 08:21:08 +0400
committerAlexander Barkov <bar@mariadb.com>2019-10-14 08:21:08 +0400
commit5392726e3c4f924745412500a7d1e030226a68d1 (patch)
treeb4267ef4878509fad2ee7d98bce7e07a37ac7c85 /plugin/type_inet/mysql-test/type_inet
parentfa8437908ba55022d5f186d63dec4f01afb59746 (diff)
downloadmariadb-git-5392726e3c4f924745412500a7d1e030226a68d1.tar.gz
MDEV-20818 ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table
The patch for `MDEV-20795 CAST(inet6 AS BINARY) returns wrong result` unintentionally changed what Item_char_typecast::type_handler() returns. This broke UNIONs with the BINARY() function, as the Aria engine started to get columns of unexpected data types. Restoring previous behaviour, to return Type_handler::string_type_handler(max_length). The prototype for Item_handed_func::return_type_handler() has changed from: const Type_handler *return_type_handler() const to: const Type_handler *return_type_handler(const Item_handled_func *) const
Diffstat (limited to 'plugin/type_inet/mysql-test/type_inet')
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.result37
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.test25
2 files changed, 62 insertions, 0 deletions
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
index 9e3601e414b..4cc1ac370a0 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
@@ -1931,3 +1931,40 @@ INSERT INTO t1 (a) VALUES ('::');
ALTER TABLE t1 MODIFY a DATE;
ERROR 22007: Incorrect date value: '::' for column `test`.`t1`.`a` at row 1
DROP TABLE t1;
+#
+# MDEV-20818 ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table
+#
+CREATE TABLE t1 (a INET6);
+SELECT
+CAST(a AS BINARY(0)),
+CAST(a AS BINARY(1)),
+CAST(a AS BINARY(16)),
+CAST(a AS BINARY(255)),
+CAST(a AS BINARY(256)),
+CAST(a AS BINARY(512)),
+CAST(a AS BINARY(513)),
+CAST(a AS BINARY(65532)),
+CAST(a AS BINARY(65533)),
+CAST(a AS BINARY(65534)),
+CAST(a AS BINARY(65535)),
+CAST(a AS BINARY(65536)),
+CAST(a AS BINARY(16777215)),
+CAST(a AS BINARY(16777216))
+FROM t1;
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def CAST(a AS BINARY(0)) 254 0 0 Y 128 0 63
+def CAST(a AS BINARY(1)) 254 1 0 Y 128 0 63
+def CAST(a AS BINARY(16)) 254 16 0 Y 128 0 63
+def CAST(a AS BINARY(255)) 254 255 0 Y 128 0 63
+def CAST(a AS BINARY(256)) 253 256 0 Y 128 0 63
+def CAST(a AS BINARY(512)) 253 512 0 Y 128 0 63
+def CAST(a AS BINARY(513)) 253 513 0 Y 128 0 63
+def CAST(a AS BINARY(65532)) 253 65532 0 Y 128 0 63
+def CAST(a AS BINARY(65533)) 252 65533 0 Y 128 0 63
+def CAST(a AS BINARY(65534)) 252 65534 0 Y 128 0 63
+def CAST(a AS BINARY(65535)) 252 65535 0 Y 128 0 63
+def CAST(a AS BINARY(65536)) 250 65536 0 Y 128 0 63
+def CAST(a AS BINARY(16777215)) 250 16777215 0 Y 128 0 63
+def CAST(a AS BINARY(16777216)) 251 16777216 0 Y 128 0 63
+CAST(a AS BINARY(0)) CAST(a AS BINARY(1)) CAST(a AS BINARY(16)) CAST(a AS BINARY(255)) CAST(a AS BINARY(256)) CAST(a AS BINARY(512)) CAST(a AS BINARY(513)) CAST(a AS BINARY(65532)) CAST(a AS BINARY(65533)) CAST(a AS BINARY(65534)) CAST(a AS BINARY(65535)) CAST(a AS BINARY(65536)) CAST(a AS BINARY(16777215)) CAST(a AS BINARY(16777216))
+DROP TABLE t1;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
index a17f5dd69f7..875aaa0b7e9 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
@@ -1411,3 +1411,28 @@ INSERT INTO t1 (a) VALUES ('::');
--error ER_TRUNCATED_WRONG_VALUE
ALTER TABLE t1 MODIFY a DATE;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-20818 ER_CRASHED_ON_USAGE or Assertion `length <= column->length' failed in write_block_record on temporary table
+--echo #
+
+CREATE TABLE t1 (a INET6);
+--enable_metadata
+SELECT
+ CAST(a AS BINARY(0)),
+ CAST(a AS BINARY(1)),
+ CAST(a AS BINARY(16)),
+ CAST(a AS BINARY(255)),
+ CAST(a AS BINARY(256)),
+ CAST(a AS BINARY(512)),
+ CAST(a AS BINARY(513)),
+ CAST(a AS BINARY(65532)),
+ CAST(a AS BINARY(65533)),
+ CAST(a AS BINARY(65534)),
+ CAST(a AS BINARY(65535)),
+ CAST(a AS BINARY(65536)),
+ CAST(a AS BINARY(16777215)),
+ CAST(a AS BINARY(16777216))
+FROM t1;
+--disable_metadata
+DROP TABLE t1;