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 0ac5f666b865a..6e05d589695ba 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result @@ -2194,3 +2194,36 @@ SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1'; f :: DROP TABLE t1; +# +# MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string +# +SET sql_mode=''; +SET @@SESSION.max_sort_length=4; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '4' +CREATE TEMPORARY TABLE t1(c INET6,d DATE); +INSERT INTO t1 VALUES(0,0); +Warnings: +Warning 1292 Incorrect inet6 value: '0' for column `test`.`t1`.`c` at row 1 +SELECT c FROM t1 ORDER BY c; +c +:: +DROP TABLE t1; +SET max_sort_length=DEFAULT; +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a INET6); +INSERT INTO t1 VALUES ('::'),('f::f'); +SET SESSION max_sort_length= 8; +Warnings: +Warning 1292 Truncated incorrect max_sort_length value: '8' +SELECT CASE 1 WHEN 0 THEN 'foo' ELSE a END AS f FROM t1 GROUP BY f WITH ROLLUP; +f +:: +f::f +NULL +SELECT CASE 1 WHEN 0 THEN 'foo' ELSE a END AS f FROM t1 GROUP BY f; +f +:: +f::f +DROP TABLE t1; +SET max_sort_length=DEFAULT; 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 6a5db1ad43fdc..09f7e235cd8df 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -1612,3 +1612,24 @@ SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != ''; SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::'; SELECT IF(1, '::', a) AS f FROM t1 GROUP BY 'foo' HAVING f != '::1'; DROP TABLE t1; + +--echo # +--echo # MDEV-22256 Assertion `length == pack_length()' failed in Field_timestamp_with_dec::sort_string +--echo # + +SET sql_mode=''; +SET @@SESSION.max_sort_length=4; +CREATE TEMPORARY TABLE t1(c INET6,d DATE); +INSERT INTO t1 VALUES(0,0); +SELECT c FROM t1 ORDER BY c; +DROP TABLE t1; +SET max_sort_length=DEFAULT; +SET sql_mode=DEFAULT; + +CREATE TABLE t1 (a INET6); +INSERT INTO t1 VALUES ('::'),('f::f'); +SET SESSION max_sort_length= 8; +SELECT CASE 1 WHEN 0 THEN 'foo' ELSE a END AS f FROM t1 GROUP BY f WITH ROLLUP; +SELECT CASE 1 WHEN 0 THEN 'foo' ELSE a END AS f FROM t1 GROUP BY f; +DROP TABLE t1; +SET max_sort_length=DEFAULT;