Commit a11694b8 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-20826 Wrong result of MIN(inet6) with GROUP BY

Type_handler_inet6::is_val_native_ready() was not overriden and
returned "false" by default, so Item_sum_min_max::update_field()
erroneously went through the min_max_update_str_field() rather than
min_max_update_native_field() execution path. As a result '8888::'
was compared to 'fff::' in string format (rather than INET6 binary format)
and gave "less" instead of "greater".

Adding the forgotten overriding method returning "true".
parent ba8e5e68
...@@ -1968,3 +1968,12 @@ def CAST(a AS BINARY(16777215)) 250 16777215 0 Y 128 0 63 ...@@ -1968,3 +1968,12 @@ 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 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)) 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; DROP TABLE t1;
#
# MDEV-20826 Wrong result of MIN(inet6) with GROUP BY
#
CREATE TABLE t1 (id INT, a INET6) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, 'fff::'),(1, '8888::');
SELECT MIN(a), MAX(a) FROM t1 GROUP BY id;
MIN(a) MAX(a)
fff:: 8888::
DROP TABLE t1;
...@@ -1436,3 +1436,12 @@ SELECT ...@@ -1436,3 +1436,12 @@ SELECT
FROM t1; FROM t1;
--disable_metadata --disable_metadata
DROP TABLE t1; DROP TABLE t1;
--echo #
--echo # MDEV-20826 Wrong result of MIN(inet6) with GROUP BY
--echo #
CREATE TABLE t1 (id INT, a INET6) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1, 'fff::'),(1, '8888::');
SELECT MIN(a), MAX(a) FROM t1 GROUP BY id;
DROP TABLE t1;
...@@ -386,6 +386,7 @@ class Type_handler_inet6: public Type_handler ...@@ -386,6 +386,7 @@ class Type_handler_inet6: public Type_handler
} }
bool is_scalar_type() const override { return true; } bool is_scalar_type() const override { return true; }
bool is_val_native_ready() const override { return true; }
bool can_return_int() const override { return false; } bool can_return_int() const override { return false; }
bool can_return_decimal() const override { return false; } bool can_return_decimal() const override { return false; }
bool can_return_real() const override { return false; } bool can_return_real() const override { return false; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment