From 059a8fd87eb900a5a12185b1963e5623df874c21 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 28 Jan 2022 22:32:56 +0400 Subject: MDEV-27668 Assertion `item->type_handler()->is_traditional_scalar_type() || item->type_handler() == type_handler()' failed in Field_inet6::can_optimize_keypart_ref --- .../mysql-test/type_inet/type_inet6_mix_json.result | 21 +++++++++++++++++++++ .../mysql-test/type_inet/type_inet6_mix_json.test | 18 ++++++++++++++++++ plugin/type_inet/sql_type_inet.cc | 8 ++++++-- 3 files changed, 45 insertions(+), 2 deletions(-) (limited to 'plugin') diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_json.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_json.result index eb35a9a09ca..2b6603a51c3 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_json.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mix_json.result @@ -40,3 +40,24 @@ ERROR HY000: Illegal parameter data types inet6 and longblob/json for operation SELECT a+c FROM t1; ERROR HY000: Illegal parameter data types inet6 and longblob for operation '+' DROP TABLE t1; +# +# MDEV-27668 Assertion `item->type_handler()->is_traditional_scalar_type() || item->type_handler() == type_handler()' failed in Field_inet6::can_optimize_keypart_ref +# +CREATE TABLE t1 (i INET6 PRIMARY KEY); +CREATE TABLE t2 (a VARCHAR(40) CHECK (JSON_VALID(a))); +SELECT * FROM t1 JOIN t2 ON (i = a); +i a +INSERT INTO t1 VALUES ('::'),('ffff::ffff'); +INSERT INTO t2 VALUES ('{}'),('[]'); +SELECT * FROM t1 JOIN t2 ON (i = a); +i a +DROP TABLE t1, t2; +CREATE TABLE t1 (i INET6 PRIMARY KEY); +SELECT * FROM t1 WHERE itype_handler()->is_traditional_scalar_type() || item->type_handler() == type_handler()' failed in Field_inet6::can_optimize_keypart_ref +--echo # + +CREATE TABLE t1 (i INET6 PRIMARY KEY); +CREATE TABLE t2 (a VARCHAR(40) CHECK (JSON_VALID(a))); +SELECT * FROM t1 JOIN t2 ON (i = a); +INSERT INTO t1 VALUES ('::'),('ffff::ffff'); +INSERT INTO t2 VALUES ('{}'),('[]'); +SELECT * FROM t1 JOIN t2 ON (i = a); +DROP TABLE t1, t2; + +CREATE TABLE t1 (i INET6 PRIMARY KEY); +SELECT * FROM t1 WHERE itype_handler()->is_traditional_scalar_type() || + DBUG_ASSERT(item->type_handler()->type_handler_base_or_self()-> + is_traditional_scalar_type() || item->type_handler() == type_handler()); return true; } @@ -951,7 +954,8 @@ public: bool is_eq_func) const override { // See the DBUG_ASSERT comment in can_optimize_keypart_ref() - DBUG_ASSERT(item->type_handler()->is_traditional_scalar_type() || + DBUG_ASSERT(item->type_handler()->type_handler_base_or_self()-> + is_traditional_scalar_type() || item->type_handler() == type_handler()); return true; } -- cgit v1.2.1