summaryrefslogtreecommitdiff
path: root/plugin/type_inet/mysql-test/type_inet
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2022-07-05 11:39:40 +0400
committerAlexander Barkov <bar@mariadb.com>2022-07-05 12:11:14 +0400
commitc12192b1c663a50d76245fc2f6f6617f6df5da66 (patch)
treec5138e9ff2cc7cd215ed34cb9f204fc70ae0a199 /plugin/type_inet/mysql-test/type_inet
parent3dff84cd158ed09e9c5b1a390af7571fd671f012 (diff)
downloadmariadb-git-c12192b1c663a50d76245fc2f6f6617f6df5da66.tar.gz
MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt()bb-10.7-bar
The assuption that Field::is_null() is always false when Field_fbt::val_native() or Field_fbt::to_fbt() are called was wrong. In some cases, e.g. when this helper Field method is called: inline String *val_str(String *str, const uchar *new_ptr) we temporarily reset Field::ptr to some alternative record buffer but don't reset null_ptr, so null_ptr still points to null flags of the original record. In such cases it's meaningless to test the original Field::null_ptr when Field::ptr is temporarily reset: they don't relate to each other. Removing the DBUG_ASSERT.
Diffstat (limited to 'plugin/type_inet/mysql-test/type_inet')
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.result28
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6.test15
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result51
-rw-r--r--plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test41
4 files changed, 135 insertions, 0 deletions
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 932f3a68625..570655a972b 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result
@@ -2213,3 +2213,31 @@ SELECT * FROM companies;
id name
DROP TABLE divisions;
DROP TABLE companies;
+#
+# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt()
+#
+CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a INET6(6) DEFAULT '::10');
+INSERT INTO t1(id) VALUES (1), (2), (3), (4);
+INSERT INTO t1 VALUES (5,'::5'), (6,'::6');
+SELECT * FROM t1 ORDER BY a;
+id a
+5 ::5
+6 ::6
+1 ::10
+2 ::10
+3 ::10
+4 ::10
+CREATE VIEW v1(a, m) AS SELECT a, MIN(id) FROM t1 GROUP BY a;
+CREATE TABLE t2 SELECT * FROM v1;
+SELECT * FROM v1 ORDER BY a;
+a m
+::5 5
+::6 6
+::10 1
+SELECT * FROM t2 ORDER BY a;
+a m
+::5 5
+::6 6
+::10 1
+DROP VIEW v1;
+DROP TABLE t1, t2;
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 72059bd060c..f7453d2d67e 100644
--- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test
@@ -1629,3 +1629,18 @@ DELETE FROM companies WHERE id IN (SELECT company_id FROM divisions);
SELECT * FROM companies;
DROP TABLE divisions;
DROP TABLE companies;
+
+--echo #
+--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt()
+--echo #
+
+CREATE TABLE t1 (id int NOT NULL PRIMARY KEY, a INET6(6) DEFAULT '::10');
+INSERT INTO t1(id) VALUES (1), (2), (3), (4);
+INSERT INTO t1 VALUES (5,'::5'), (6,'::6');
+SELECT * FROM t1 ORDER BY a;
+CREATE VIEW v1(a, m) AS SELECT a, MIN(id) FROM t1 GROUP BY a;
+CREATE TABLE t2 SELECT * FROM v1;
+SELECT * FROM v1 ORDER BY a;
+SELECT * FROM t2 ORDER BY a;
+DROP VIEW v1;
+DROP TABLE t1, t2;
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result
new file mode 100644
index 00000000000..df268156981
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.result
@@ -0,0 +1,51 @@
+#
+# Start of 10.7 tests
+#
+#
+# MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt()
+#
+CREATE TABLE t1 (i6 INET6, a1 TIME, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::','09:43:12','uw'), ('70:ef59::46:c7b:f:678:bd9f','00:00:00','a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1)
+::
+Warnings:
+Warning 1292 Incorrect inet6 value: 'a'
+DROP TABLE t1;
+CREATE TABLE t1 (i6 inet6, a2 varchar(10));
+INSERT INTO t1 VALUES ('::','uw'), (null,'a');
+SELECT group_concat(coalesce(i6, a2) ORDER BY 1) FROM t1;
+group_concat(coalesce(i6, a2) ORDER BY 1)
+::
+Warnings:
+Warning 1292 Incorrect inet6 value: 'a'
+DROP TABLE t1;
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES();
+SELECT JSON_ARRAYAGG(a ORDER BY a DESC) FROM t1;
+JSON_ARRAYAGG(a ORDER BY a DESC)
+[null]
+DROP TABLE t1;
+CREATE TABLE t1 (i6 INET6, a1 INT, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',1,'uw'), ('70:ef59::46:c7b:f:678:bd9f',0,'a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1)
+::
+Warnings:
+Warning 1292 Incorrect inet6 value: 'a'
+DROP TABLE t1;
+CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',''), (NULL,NULL);
+SELECT GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) FROM t1;
+GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1)
+::
+DROP TABLE t1;
+CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',''), (NULL,NULL);
+SELECT GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) FROM t1;
+GROUP_CONCAT(DISTINCT COALESCE(i6, a2))
+::
+DROP TABLE t1;
+#
+# End of 10.7 tests
+#
diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test
new file mode 100644
index 00000000000..71dfcebf71a
--- /dev/null
+++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_sum.test
@@ -0,0 +1,41 @@
+--echo #
+--echo # Start of 10.7 tests
+--echo #
+
+--echo #
+--echo # MDEV-27015 Assertion `!is_null()' failed in FixedBinTypeBundle<FbtImpl>::Fbt FixedBinTypeBundle<FbtImpl>::Field_fbt::to_fbt()
+--echo #
+
+CREATE TABLE t1 (i6 INET6, a1 TIME, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::','09:43:12','uw'), ('70:ef59::46:c7b:f:678:bd9f','00:00:00','a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (i6 inet6, a2 varchar(10));
+INSERT INTO t1 VALUES ('::','uw'), (null,'a');
+SELECT group_concat(coalesce(i6, a2) ORDER BY 1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (a INET6);
+INSERT INTO t1 VALUES();
+SELECT JSON_ARRAYAGG(a ORDER BY a DESC) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (i6 INET6, a1 INT, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',1,'uw'), ('70:ef59::46:c7b:f:678:bd9f',0,'a');
+SELECT GROUP_CONCAT(IF(a1, i6, a2) ORDER BY 1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',''), (NULL,NULL);
+SELECT GROUP_CONCAT(COALESCE(i6, a2) ORDER BY 1) FROM t1;
+DROP TABLE t1;
+
+CREATE TABLE t1 (i6 INET6, a2 VARCHAR(10));
+INSERT INTO t1 VALUES ('::',''), (NULL,NULL);
+SELECT GROUP_CONCAT(DISTINCT COALESCE(i6, a2)) FROM t1;
+DROP TABLE t1;
+
+--echo #
+--echo # End of 10.7 tests
+--echo #