mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-27668 Assertion `item->type_handler()->is_traditional_scalar_type() || item->type_handler() == type_handler()' failed in Field_inet6::can_optimize_keypart_ref
This commit is contained in:
parent
fb8fea3490
commit
059a8fd87e
4 changed files with 50 additions and 2 deletions
|
@ -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 i<JSON_OBJECT('c','b');
|
||||
i
|
||||
INSERT INTO t1 VALUES ('::'),('ffff::ffff');
|
||||
SELECT * FROM t1 WHERE i<JSON_OBJECT('c','b');
|
||||
i
|
||||
Warnings:
|
||||
Warning 1292 Incorrect inet6 value: '{"c": "b"}'
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -48,3 +48,21 @@ SELECT a+b FROM t1;
|
|||
SELECT a+c FROM t1;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-27668 Assertion `item->type_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 i<JSON_OBJECT('c','b');
|
||||
INSERT INTO t1 VALUES ('::'),('ffff::ffff');
|
||||
SELECT * FROM t1 WHERE i<JSON_OBJECT('c','b');
|
||||
DROP TABLE t1;
|
||||
|
|
|
@ -936,8 +936,11 @@ public:
|
|||
Mixing of two different non-traditional types is currently prevented.
|
||||
This may change in the future. For example, INET4 and INET6
|
||||
data types can be made comparable.
|
||||
But we allow mixing INET6 to a data type directly inherited from
|
||||
a traditional type, e.g. INET6=VARCHAR/JSON.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -3773,6 +3773,11 @@ public:
|
|||
{
|
||||
return NULL;
|
||||
}
|
||||
const Type_handler *type_handler_base_or_self() const
|
||||
{
|
||||
const Type_handler *res= type_handler_base();
|
||||
return res ? res : this;
|
||||
}
|
||||
virtual const Type_handler *type_handler_for_comparison() const= 0;
|
||||
virtual const Type_handler *type_handler_for_native_format() const
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue