summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result12
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result4
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result12
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.result17
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.test19
-rw-r--r--plugin/type_inet/sql_type_inet.cc7
6 files changed, 40 insertions, 31 deletions
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result
index ad2d22c2153..5f7063b8f4b 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_innodb.result
@@ -30,13 +30,11 @@ SELECT * FROM t1 WHERE a='garbage';
a
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a='garbage';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a>='::fe';
a
::fe
@@ -46,13 +44,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a>='garbage';
a
-Warnings:
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a>='garbage';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-Warnings:
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
a
::80
@@ -67,13 +61,11 @@ a
::a0
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
a
::80
@@ -83,13 +75,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
a
-Warnings:
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-Warnings:
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
a
::ff
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result
index 56c4ae8231d..db4196366ca 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_memory.result
@@ -30,13 +30,11 @@ SELECT * FROM t1 WHERE a='garbage';
a
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a='garbage';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a>='::fe';
a
::fe
@@ -65,13 +63,11 @@ a
::a0
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 17 NULL 4 Using where
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
a
::80
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result
index 6525bda5aa5..c8dba6ff959 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_myisam.result
@@ -30,13 +30,11 @@ SELECT * FROM t1 WHERE a='garbage';
a
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a='garbage';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a>='::fe';
a
::fe
@@ -46,13 +44,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a>='garbage';
a
-Warnings:
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a>='garbage';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-Warnings:
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a IN ('::80','::a0','::f0');
a
::80
@@ -67,13 +61,11 @@ a
::a0
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a IN ('::80','::a0','garbage');
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
Warnings:
Warning 1292 Incorrect inet6 value: 'garbage'
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a BETWEEN '::80' AND '::81';
a
::80
@@ -83,13 +75,9 @@ id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range a a 17 NULL 2 Using where; Using index
SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
a
-Warnings:
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
EXPLAIN SELECT * FROM t1 WHERE a BETWEEN '::80' AND 'garbage';
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
-Warnings:
-Warning 1292 Incorrect inet6 value: 'garbage' for column `test`.`t1`.`a` at row 1
SELECT * FROM t1 WHERE a=CAST('::ff' AS INET6);
a
::ff
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.result
new file mode 100644
index 00000000000..6d84d105c99
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.result
@@ -0,0 +1,17 @@
+#
+# Start of 10.5 tests
+#
+#
+# MDEV-20800 Server crashes in Field_inet6::store_warning upon updating table statistics
+#
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('1::1'),('2::2');
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
+INSERT INTO t1 VALUES ('3::3');
+DROP TABLE t1;
+#
+# End of 10.5 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.test
new file mode 100644
index 00000000000..fb092db6bc4
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_stat_tables.test
@@ -0,0 +1,19 @@
+--source include/have_stat_tables.inc
+
+--echo #
+--echo # Start of 10.5 tests
+--echo #
+
+--echo #
+--echo # MDEV-20800 Server crashes in Field_inet6::store_warning upon updating table statistics
+--echo #
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES ('1::1'),('2::2');
+ANALYZE TABLE t1 PERSISTENT FOR ALL;
+INSERT INTO t1 VALUES ('3::3');
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.5 tests
+--echo #
diff --git a/plugin/type_inet/sql_type_inet.cc b/plugin/type_inet/sql_type_inet.cc
index 322f494ba2b..9bf77e62d24 100644
--- a/plugin/type_inet/sql_type_inet.cc
+++ b/plugin/type_inet/sql_type_inet.cc
@@ -609,9 +609,10 @@ class Field_inet6: public Field
Sql_condition::enum_warning_level level)
{
static const Name type_name= type_handler_inet6.name();
- get_thd()->push_warning_truncated_value_for_field(level, type_name.ptr(),
- str.ptr(), table->s,
- field_name.str);
+ if (get_thd()->count_cuted_fields > CHECK_FIELD_EXPRESSION)
+ get_thd()->push_warning_truncated_value_for_field(level, type_name.ptr(),
+ str.ptr(), table->s,
+ field_name.str);
}
int set_null_with_warn(const ErrConv &str)
{